highcharts - 在 dotnet highcharts 中点击 DRILLEDOWN PIE Charts 后打开柱形图
问题描述
我正在使用Highsoft.Web.Mvc.Charts
。我有一个 PIE 图表,现在我想在单击向下钻取的饼图的任何点后打开一个柱形图。我的代码是
<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")
提前感谢您的帮助。
解决方案
感谢 http://jsfiddle.net/nagoba/V4q69/1/得到了答案
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)
}
}
}
}
}
},
推荐阅读
- vba - 在更改 VBA 代码之前不会触发 Word 中的 Document_open 宏(无关紧要)
- arrays - 如何在数组中打包结构并删除零填充?
- django - Django Tempus Dominus:设置格式会使表单无效
- typescript - 如何根据打字稿中的父对象检查属性的类型?
- svg - 使用 OpenXML 将 SVG 插入 Word 文档
- python - 二级外键关系
- flutter - 我怎样才能在颤动中做这种类型的渐变
- flutter - 在 dispose() 之后调用 setState() 导致 SpinKit 包内的错误
- javascript - 使用 Code.gs 中的 javascript 从数组值中获取动态 html 表
- javascript - jQuery:单击按钮时重置滚动条