我有一个 Highcharts 图形http://jsfiddle.net/jerryvermanen/XRjyc/,但我想添加一个输入字段。输入字段要求一年。输入后:
- 图形应在输入年份的基础上增加一年(因此 1992 变为 1993)。
- 该图形应在输入年份 + 1 上显示一条垂直绘图线(因此为 1993 年的一条线)。
- 它还应该在五年后(1998 年)和五年后(2003 年)添加一行,依此类推。
- 它还应该取这些年份(1993、1998、2003、2008、2013)的百分比并将它们添加到文本中。比如,“你支付 X%、Y%、Z% 等等。”
让事情变得更复杂一点,对于输入年份 1992 (4,94%)、1993 (3,74%)、1994 (4,77%)、1996 (4,52%)、1997 (4,94% )、1998 (3,74%) 和 1999 (4,77%),应在 2001 年 3 月 1 日添加 () 之间的百分比。
chart = new Highcharts.Chart({ exporting: { enabled: false }, chart: { renderTo: 'container', type: 'spline', marginRight: 20 }, title: { text: 'Rente DUO' }, subtitle: { text: '' }, xAxis: { type: 'datetime', dateTimeLabelFormats: { // don't display the dummy year month: '%Y', year: '%Y' } }, yAxis: { min:0, title: { text: 'Werkloosheid (%)' }, plotLines: [{ value: 0, width: 2, color: '#000000', zIndex: 5 }, { label: { text: 'Rente DUO', align: 'right' }, value: 5, width: 0.5, color: '#ffffff', zIndex: 1 }] }, tooltip: { formatter: function() { return '<b>'+ this.series.name +'<br/>'+ Highcharts.dateFormat('%b %Y', this.x) +':</b> '+ this.y +'%'; } }, plotOptions: { spline: { lineWidth: 3, states: { hover: { lineWidth: 4 } }, marker: { enabled: false, states: { hover: { enabled: true, symbol: 'circle', radius: 4, lineWidth: 1 } } } } }, legend: { enabled: false },
</p>
如果这很复杂,也可以通过在进入一年后绘制一个新的图表来完成。该图将是具有相同数据的阶梯线图。
这怎么能做?