Highcharts——这一点.类别返回未定义
Highcharts- this.category returns undefined
在highcharts中单击任何点或条,我想要一个警告给出X轴值…我用的是。net。Visual Studio中的highcharts我尝试了以下命令
public partial class regression
{
DataSet dsSeries = new DataSet();
ArrayList totalCount , failCount,passCount ,Week = new ArrayList();
object[] totalValues, passValues, failValues;
protected void Page_Load(object sender, EventArgs e)
{
Report();
}
public DataSet BindData()
{
String conString = ConfigurationManager.ConnectionStrings["xxxxxxxxConnectionString"].ConnectionString;
MySqlConnection connection = new MySqlConnection(conString);
connection.Open();
MySqlCommand command = new MySqlCommand();
command.CommandText = "SELECT `Week`,`total`,`PassCount`,`FailCount` FROM Regression";
command.Connection = connection;
MySqlDataAdapter da = new MySqlDataAdapter(command);
try
{
DataSet ds = new DataSet();
da.Fill(ds);
return ds;
}
catch (Exception ex)
{
throw ex;
}
}
private void Report()
{
dsSeries = BindData();
if (dsSeries == null) return;
foreach (DataRow ww in dsSeries.Tables[0].Rows)
{
Week.Add(ww["Week"]);
}
foreach (DataRow tot in dsSeries.Tables[0].Rows)
{
totalCount.Add(Convert.ToInt32(tot["total"]));
totalValues = totalCount.ToArray(typeof(object)) as object[];
}
foreach (DataRow pass in dsSeries.Tables[0].Rows)
{
passCount.Add(Convert.ToInt32(pass["PassCount"]));
passValues = passCount.ToArray(typeof(object)) as object[];
}
foreach (DataRow fail in dsSeries.Tables[0].Rows)
{
failCount.Add(Convert.ToInt32(fail["FailCount"]));
failValues = failCount.ToArray(typeof(object)) as object[];
}
hcline.Title = new Title ("Report");
hcline.YAxis.Add(new YAxisItem { title = new Title("Number of Tests") });
hcline.XAxis.Add(new XAxisItem { title= new Title("Week"), categories = Week.ToArray(typeof(string)) as string[] });
var series = new Collection<Serie>();
series.Add(new Serie { name = "Pass", data = passValues });
series.Add(new Serie { name = "Fail", data = failValues });
hcline.PlotOptions = new PlotOptionsLine { dataLabels = new DataLabels { enabled = true } };
hcline.PlotOptions.events = new Highchart.Core.Events.PlotOptionEvents { click = "alert('hi :'+ this.category)" };
//customize tooltip
hcline.Tooltip = new ToolTip("'WW'+this.x +': '+ this.y");
//bind to controls
hcline.DataSource = series;
hcline.DataBind();
}
}
返回值undefined我也试过
this.x
event.point.x
。x返回undefined, event.point.x返回类别的索引。但是这个。
如何实现品类的价值?
请帮助! !
您可以使用event.point.category
来获取类别的值
相关文章:
- 这.SOMETHING 总是返回未定义的 - extjs
- React+Meteor:this.ops返回未定义
- 解析-为什么user.getSessionToken()返回未定义的结果
- Javascript函数返回未定义
- JavaScript-获取数据属性的值返回未定义的值
- .val()返回未定义的.text返回随机代码
- 为什么innerHTML返回“未定义”
- "这个“;正在返回未定义的
- 谷歌地图:函数返回未定义的值在console.log中运行良好
- Javascript json返回未定义
- importScripts在web工作程序中返回未定义的
- 访问嵌套 json 对象的属性将返回未定义
- NativeAppEventEmitter返回未定义的
- 我的函数返回“未定义”
- 新手Javascript函数返回未定义的石头剪刀游戏
- Nodejs模块函数返回未定义的,而不是异步的
- .getElementById在.createTextNode中返回未定义
- javascript函数不返回未定义的值
- Typeahead的Javascript类型返回未定义
- Javascript可见元素返回未定义