在dotnet highcharts中钻出向下饼图后打开柱状图
我使用的是在dotnet highcharts中钻出向下饼图后打开柱状图,highcharts,asp.net-mvc-5,dotnethighcharts,Highcharts,Asp.net Mvc 5,Dotnethighcharts,我使用的是Highsoft.Web.Mvc.Charts。我现在有一个饼图和它的向下钻取部分。单击向下钻取的饼图的任何点后,我想打开一个柱状图。我的代码是 <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <scri
Highsoft.Web.Mvc.Charts
。我现在有一个饼图和它的向下钻取部分。单击向下钻取的饼图的任何点后,我想打开一个柱状图。我的代码是
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
@using Highsoft.Web.Mvc.Charts
@{
Highcharts chart2 = new Highcharts
{
Title = new Title
{
Text = "Total Pages Accessed by Teams"
},
Subtitle = new Subtitle
{
Text = "RiO."
},
XAxis = new List<XAxis>
{
new XAxis
{
Type = XAxisType.Category
}
},
YAxis = new List<YAxis>
{
new YAxis
{
Title = new YAxisTitle
{
Text = "Total percent market share"
}
}
},
Legend = new Legend
{
Enabled = false
},
Tooltip = new Tooltip
{
HeaderFormat = "<span style='font-size:11px'>{series.name}</span><br>",
PointFormat = "<span style=\"color:{point.color}\">{point.name}</span>: <b>{point.y}</b> Pages<br/>"
},
PlotOptions = new PlotOptions
{
Series = new PlotOptionsSeries
{
DataLabels = new PlotOptionsSeriesDataLabels
{
Enabled = true,
Format = "{point.name}: {point.y}"
},
Cursor = PlotOptionsSeriesCursor.Pointer,
Point = new PlotOptionsSeriesPoint
{
Events = new PlotOptionsSeriesPointEvents
{
}
}
}
},
Series = new List<Series>
{
new PieSeries
{
Name = "Teams data",
Data = @ViewData["pieData"] as List<PieSeriesData>
}
},
Drilldown = new Drilldown
{
Series = @ViewData["Series"] as List<Series>
}
};
}
@Html.Highsoft().GetHighcharts(chart2, "chart2")
@使用Highsoft.Web.Mvc.Charts
@{
Highcharts chart2=新的Highcharts
{
标题=新标题
{
Text=“团队访问的总页面数”
},
字幕=新字幕
{
Text=“里约。”
},
XAxis=新列表
{
新XAxis
{
Type=XAxisType.Category
}
},
YAxis=新列表
{
新亚克斯
{
Title=新的YAxisTitle
{
Text=“总市场份额百分比”
}
}
},
图例=新图例
{
已启用=错误
},
工具提示=新工具提示
{
HeaderFormat=“{series.name}
”,
PointFormat=“{point.name}:{point.y}页
”
},
PlotOptions=新的PlotOptions
{
系列=新绘图选项系列
{
DataLabels=新绘图选项系列DataLabels
{
启用=真,
Format=“{point.name}:{point.y}”
},
游标=绘图选项系列游标指针,
点=新绘图选项系列点
{
事件=新绘图选项系列点事件
{
}
}
}
},
系列=新列表
{
新系列
{
Name=“团队数据”,
Data=@ViewData[“pieData”]作为列表
}
},
向下钻取=新向下钻取
{
Series=@ViewData[“Series”]作为列表
}
};
}
@Html.Highsoft().GetHighcharts(图表2,“图表2”)
提前感谢您的帮助。得到了答案,感谢
plotOptions:{
馅饼:{
allowPointSelect:true,
光标:“指针”,
数据标签:{
启用:对,
颜色:'#000000',
连接器颜色:'#000000',
格式化程序:函数(){
返回“+this.point.name+”:“+this.percentage+”%”;
}
},
要点:{
事件:{
单击:函数(){
if(this.x!=“”&this.x!=null)
drawColumnGraph(this.name)
}
}
}
}
}
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
connectorColor: '#000000',
formatter: function () {
return '<b>' + this.point.name + '</b>: ' + this.percentage + ' %';
}
},
point: {
events: {
click: function () {
if (this.x != "" && this.x != null)
drawColumnGraph(this.name)
}
}
}
}
}
},