チャートのエクスポートのリストに新しいボタンを追加したい、そのようなことを実行したい:http://jsfiddle.net/3GNZC/189/
しかし、DotNet HighChartsを使用して、私はすでにそれをしようとしました:
DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart1")
.InitChart(new Chart
{
BorderColor = System.Drawing.Color.Gray,
Height = ChartHeight
});
chart.SetExporting(new Exporting
{
Buttons = new ExportingButtons()
{
ContextButton = new ExportingButtonsContextButton()
{
MenuItems = **what can i write here!**
}
},
Enabled = true,
});
ここでの私の問題は、(PNG画像のダウンロード、....)のようにすでに存在するオプションを削除せずにContextButtonに新しいMenuItemsを追加できないことです。
間違いなく、これはパッケージ開発者の介入を必要とするバグです。ラッパー開発者に直接報告したので、決定を待つ必要があります。これを回避するには、以下のコードをの<script>
タグに一時的に貼り付けます.cshtml
。これにより、ボタンがHighchartsオブジェクトにグローバルに追加され、.Netがバイパスされます。
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
@using Highsoft.Web.Mvc.Charts
<script type="text/javascript">
Highcharts.getOptions().exporting.buttons.contextButton.menuItems.push({
text: 'Add Issue ',
onclick: function() {
alert('OK');
}
function formatXAxis() {
return this.value; // clean, unformatted number for year
}
function formatYAxis() {
return this.value / 1000 + 'k';
}
</script>
@(Html.Highsoft().GetHighcharts(
new Highcharts
{
Title = new Title
{
Text = "US and USSR nuclear stockpiles"
},
Subtitle = new Subtitle
{
Text = "Source: <a href='http://thebulletin.metapress.com/content/c4120650912x74k7/fulltext.pdf'>thebulletin.metapress.com</a>"
},
XAxis = new List<XAxis>
{
new XAxis
{
AllowDecimals = false,
Labels = new XAxisLabels
{
Formatter = "formatXAxis"
}
}
},
YAxis = new List<YAxis>
{
new YAxis
{
Title = new YAxisTitle
{
Text = "Nuclear weapon states"
},
Labels = new YAxisLabels
{
Formatter = "formatYAxis"
}
}
},
Tooltip = new Tooltip
{
PointFormat = "{series.name} produced <b>{point.y:,.0f}</b><br/>warheads in {point.x}"
},
PlotOptions = new PlotOptions
{
Area = new PlotOptionsArea
{
PointStart = 1940,
Marker = new PlotOptionsAreaMarker
{
Enabled = false,
Symbol = "circle",
Radius = 2,
States = new PlotOptionsAreaMarkerStates
{
Hover = new PlotOptionsAreaMarkerStatesHover
{
Enabled = true
}
}
}
}
},
Series = new List<Series>
{
new AreaSeries
{
Name = "USA",
Data = @ViewData["usaData"] as List<AreaSeriesData>
},
new AreaSeries
{
Name = "USSR/Russia",
Data = @ViewData["russiaData"] as List<AreaSeriesData>
}
}
}
, "chart")
)
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加