HighCharts.正在将id为的系列添加到yAxis
HighCharts. Adding series to yAxis with id
我在将序列添加到高图中ID不同的yAxis时遇到了一些问题。
我举了一个例子:
$(function () {
$('#graf').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: [{type: 'datetime',
title: {
text: 'Date'
}}],
yAxis: [],
series : []
,
tooltip: {
shared: true
},
legend: {
enabled: true,
align: 'left',
backgroundColor: '#FFFFFF',
borderColor: 'grey',
borderWidth: 1,
layout: 'vertical',
verticalAlign: 'top',
y: 0,
shadow: true
}
});
var chart = $('#graf').highcharts();
$('#add').click(function () {
chart.addAxis({ // Secondary yAxis
id: "asd",
title: {
text: 'Rainfall'
},
lineWidth: 2,
lineColor: '#08F',
opposite: true
});
chart.addAxis({ // Secondary yAxis
id: "abc",
title: {
text: 'Rainfall'
},
lineWidth: 2,
lineColor: '#08F',
opposite: true
});
chart.addSeries({
name: 'Rainfall',
type: 'column',
color: '#08F',
yAxis: "asd",
data: [ [Date.UTC(1970, 9, 27), 0 ],
[Date.UTC(1970, 10, 10), 0.6 ],
[Date.UTC(1970, 10, 18), 0.7 ],
[Date.UTC(1970, 11, 2), 0.8 ],
[Date.UTC(1970, 11, 9), 0.6 ]]
});
$(this).attr('disabled', true);
$('#remove').attr('disabled', false);
});
});
JSFIDDLE:http://jsfiddle.net/5f6b6mu9/
我有id为"asd"answers"abc"的yAxis。当试图将序列添加到"asd"y轴时,它不起作用。未捕获的类型错误:无法读取未定义的属性"length"。
以下是我的网页中发生的事情:http://i61.tinypic.com/8yx7cw.jpg
如果我把两个yaxis id都改为同一个id,这是有效的,但这不是重点。
有什么建议吗?感谢
这很简单。
添加序列后立即添加与yAxis对应的序列。
chart.addAxis({ // Secondary yAxis
id: "asd",
title: {
text: 'Rainfall'
},
lineWidth: 2,
lineColor: '#08F',
opposite: true
},false);
chart.addSeries({
name: 'Rainfall',
type: 'column',
color: '#08F',
yAxis: "asd",
data: [ [Date.UTC(1970, 9, 27), 0 ],
[Date.UTC(1970, 10, 10), 0.6 ],
[Date.UTC(1970, 10, 18), 0.7 ],
[Date.UTC(1970, 11, 2), 0.8 ],
[Date.UTC(1970, 11, 9), 0.6 ]]
});
chart.addAxis({ // Secondary yAxis
id: "abc",
title: {
text: 'Rainfall'
},
lineWidth: 2,
lineColor: '#08F',
opposite: true
},false);
在这里,我更新了你的小提琴
相关文章:
- 高图表 - 是否可以为每个系列添加工具提示格式化程序
- Highcharts条形图如何添加系列事件
- 将新的系列[0]数据添加到现有的高位图表中
- highcharts-点击后将系列添加到图表中
- 如何使用jvectormap添加带有系列的标记
- 带有表中数据的图表,如何为特定系列中的特定值添加自定义标记
- 高图表添加新系列不起作用
- 如何将自定义工具提示添加到 jqxwidget 部分饼图系列
- 高图表:动态添加数据系列,并在yAxis上动态添加类别
- 高图表 - 将系列名称添加为 X 轴标签
- 将自定义链接添加到饼图中的系列/数据部分(高图表.js)
- 将另一个系列添加到行高图表
- 为某些特定类别的新系列添加点
- 将新系列添加到类别高点
- HighCharts.正在将id为的系列添加到yAxis
- 需要帮助使用SharePoint列表和PSServices将其他系列添加到Highcharts图中
- 仅将特定系列添加到Shield UI图表图例中
- 高图:向倒排柱范围图系列添加符号
- 为不同的系列添加不同格式的工具提示
- 3D Highchart动态系列添加问题