Highcharts 散点图点击事件不工作
试图通过Highcharts.net包装器将单击事件分配给散点图点。该事件出现在javascript输出中,但在单击某个点时从不触发。图表呈现良好,具有交互性、缩放、悬停等功能。除单击事件外,所有功能均正常工作。我已在PlotOptionsSeries位置和ScatterSeries位置尝试了单击事件Highcharts 散点图点击事件不工作,highcharts,dotnethighcharts,Highcharts,Dotnethighcharts,试图通过Highcharts.net包装器将单击事件分配给散点图点。该事件出现在javascript输出中,但在单击某个点时从不触发。图表呈现良好,具有交互性、缩放、悬停等功能。除单击事件外,所有功能均正常工作。我已在PlotOptionsSeries位置和ScatterSeries位置尝试了单击事件 var chartOptions = new Highsoft.Web.Mvc.Charts.Highcharts { Chart = new Highsoft.Web.Mvc.Chart
var chartOptions = new Highsoft.Web.Mvc.Charts.Highcharts
{
Chart = new Highsoft.Web.Mvc.Charts.Chart
{
SpacingTop = 20,
SpacingBottom = 20,
SpacingLeft = 20,
SpacingRight = 20,
ZoomType = Highsoft.Web.Mvc.Charts.ChartZoomType.Xy
},
XAxis = new List<Highsoft.Web.Mvc.Charts.XAxis>
{
new Highsoft.Web.Mvc.Charts.XAxis
{ Max = 150, Min = -150,GridLineWidth = 1, TickInterval = 50,
PlotLines = new List<Highsoft.Web.Mvc.Charts.XAxisPlotLines> { new Highsoft.Web.Mvc.Charts.XAxisPlotLines { Value = 0, Width = 2, ZIndex = 5 } }
}
},
YAxis = new List<Highsoft.Web.Mvc.Charts.YAxis>
{
new Highsoft.Web.Mvc.Charts.YAxis
{
Title = new Highsoft.Web.Mvc.Charts.YAxisTitle { Text = "" },
Max = 150, Min = -150, GridLineWidth = 1, TickInterval = 50,
PlotLines = new List<Highsoft.Web.Mvc.Charts.YAxisPlotLines> { new Highsoft.Web.Mvc.Charts.YAxisPlotLines { Value = 0, Width = 2, ZIndex = 5 } }
}
},
PlotOptions = new Highsoft.Web.Mvc.Charts.PlotOptions
{
Series = new Highsoft.Web.Mvc.Charts.PlotOptionsSeries
{
AllowPointSelect = true,
},
Scatter = new Highsoft.Web.Mvc.Charts.PlotOptionsScatter
{
Marker = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarker
{
Radius = 5,
States = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarkerStates
{
Hover = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterMarkerStatesHover
{
Enabled = true,
LineColor = "rgb(100,100,100)"
}
}
},
States = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterStates
{
Hover = new Highsoft.Web.Mvc.Charts.PlotOptionsScatterStatesHover
{ }
}
}
},
Series = new List<Highsoft.Web.Mvc.Charts.Series>
{
new Highsoft.Web.Mvc.Charts.ScatterSeries
{
Name = "Dots",
Color = "rgba(223, 83, 83, .5)",
Data = pts3, // Here we put the dbase data into the chart
ZIndex = 6,
Events = new Highsoft.Web.Mvc.Charts.ScatterSeriesEvents
{
Click = "function () {alert('Clicked');console.log('Clicked');}"
},
Tooltip = new Highsoft.Web.Mvc.Charts.ScatterSeriesTooltip
{
HeaderFormat = "",
PointFormat = "<h5>{point.name}<br /></h5>"+"<b>Love It:</b>{point.x} " +
"<b>Challenge:</b>{point.y}",
FooterFormat = "",
FollowPointer = true
}
}
}
};
chartOptions.ID = "teachaggchart";
var renderer = new Highsoft.Web.Mvc.Charts.Rendering.HighchartsRenderer(chartOptions);
var chartOptions=new Highsoft.Web.Mvc.Charts.Highcharts
{
Chart=new Highsoft.Web.Mvc.Charts.Chart
{
间距=20,
间距底部=20,
间距=20,
间距=20,
ZoomType=Highsoft.Web.Mvc.Charts.ChartZoomType.Xy
},
XAxis=新列表
{
新的Highsoft.Web.Mvc.Charts.XAxis
{Max=150,Min=-150,GridLineWidth=1,TickInterval=50,
PlotLines=new List{new Highsoft.Web.Mvc.Charts.XAxisPlotLines{Value=0,Width=2,ZIndex=5}}
}
},
YAxis=新列表
{
新的Highsoft.Web.Mvc.Charts.YAxis
{
Title=new Highsoft.Web.Mvc.Charts.YAxisTitle{Text=”“},
最大值=150,最小值=150,网格线宽度=1,滴答声间隔=50,
PlotLines=new List{new Highsoft.Web.Mvc.Charts.YAxisPlotLines{Value=0,Width=2,ZIndex=5}}
}
},
PlotOptions=new Highsoft.Web.Mvc.Charts.PlotOptions
{
Series=新的Highsoft.Web.Mvc.Charts.PlotOptions Series
{
AllowPointSelect=true,
},
散布=新的Highsoft.Web.Mvc.Charts.plotoptions散布
{
Marker=新的Highsoft.Web.Mvc.Charts.Plotoptions散点标记器
{
半径=5,
状态=新的Highsoft.Web.Mvc.Charts.plotoptions散点标记状态
{
Hover=new Highsoft.Web.Mvc.Charts.plotoptions scattermarkerstateshover
{
启用=真,
LineColor=“rgb(100100)”
}
}
},
状态=新的Highsoft.Web.Mvc.Charts.plotoptions分散状态
{
Hover=new Highsoft.Web.Mvc.Charts.plotoptions分散状态清除器
{ }
}
}
},
系列=新列表
{
新的Highsoft.Web.Mvc.Charts.ScatterSeries
{
Name=“Dots”,
Color=“rgba(223,83,83,5)”,
Data=pts3,//这里我们将数据库数据放入图表中
ZIndex=6,
事件=新的Highsoft.Web.Mvc.Charts.ScatterSeriesEvents
{
Click=“function(){alert('Clicked');console.log('Clicked');}”
},
Tooltip=new Highsoft.Web.Mvc.Charts.ScatterSeriesTooltip
{
人头汇率=”,
PointFormat=“{point.name}
”+“喜欢它:{point.x}”+
“挑战:{point.y}”,
FooterFormat=“”,
FollowPointer=true
}
}
}
};
chartOptions.ID=“teachaggchart”;
var renderer=new Highsoft.Web.Mvc.Charts.Rendering.HighchartsRenderer(图表选项);
您似乎在包装器中发现了一个bug
我已经报告过了,它在新版本(8.0.0.2)中得到了修复,现在应该可以使用了
如何获取最新版本,您可以在此处找到:
让我知道它在新版本中是否有效