admin管理员组文章数量:1426033
highchart has an option which will let me set a marker to certain value.
highchart doc:
...
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, {
y: 26.5,
marker: {
symbol: 'url(/demo/gfx/sun.png)'
}
}, 23.3, 18.3, 13.9, 9.6]
...
As you can see, the position 26.5 gains a png image as its marker.
My question is: How can I set it to a certain value from my array?
$.getJSON('ajax/lineChart.ajax.php', function(data) {
$.each(data, function(key, value) {
var series = {
data: [ {
y: 0,
marker: {
symbol: 'url(img/fail.png)'
}
}], //data array for new series
name: key,
marker: {
symbol: 'square'
}
};
series.data = value;
options.series.push(series); // <-------- pushing series object
});
var chart = new Highcharts.Chart(options);
});
i tried this, but nothing appeared. The chart ran without the marker.
highchart has an option which will let me set a marker to certain value.
highchart doc:
...
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, {
y: 26.5,
marker: {
symbol: 'url(/demo/gfx/sun.png)'
}
}, 23.3, 18.3, 13.9, 9.6]
...
As you can see, the position 26.5 gains a png image as its marker.
My question is: How can I set it to a certain value from my array?
$.getJSON('ajax/lineChart.ajax.php', function(data) {
$.each(data, function(key, value) {
var series = {
data: [ {
y: 0,
marker: {
symbol: 'url(img/fail.png)'
}
}], //data array for new series
name: key,
marker: {
symbol: 'square'
}
};
series.data = value;
options.series.push(series); // <-------- pushing series object
});
var chart = new Highcharts.Chart(options);
});
i tried this, but nothing appeared. The chart ran without the marker.
Share Improve this question edited Oct 21, 2011 at 19:27 Keith Thompson 264k46 gold badges442 silver badges659 bronze badges asked Oct 21, 2011 at 18:08 Ricardo BinnsRicardo Binns 3,2466 gold badges45 silver badges71 bronze badges1 Answer
Reset to default 2The line:
series.data = value;
overwrite whatever you wrote in
var series = {
data: [ {
I am not sure what you have in the "data" variable, but assume its is as [key:[val1,val2,...],...], try replace "series.data = value" with the following:
var list= new Array();
foreach(var v as value){
if (v==0){ //or what ever condition you need to use a different mark
var m={
y: v,
marker: {
symbol: 'url(img/fail.png)'
}};
list.push(m);
}
else{
list.push(v);
}
}
series.data = list;
本文标签: javascriptset a symbol marker with highchartStack Overflow
版权声明:本文标题:javascript - set a symbol marker with highchart - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745421361a2657913.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论