0

如何在一页中组合两种类型的高图(列和行)?所以它只有一个传说。可能吗?

4

1 回答 1

1

I think this is not supported by default by HighCharts (unless Jugal can give us an example).

The only possibility I can imagine is to hide one of the legends, then suscribe to the event 'legendItemClick' in the chart with the legend enabled, and when that legend is clicked hide/show both charts.

check this fiddle: http://jsfiddle.net/b3AF9/7/

The important code is here:

series: [{
          type: 'line',
          data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 23.3, 18.3, 13.9, 9.6],
          events: {
             legendItemClick: function(event) {
                this.visible? 
                   this.chart.get('myColumnChar').hide():
                   this.chart.get('myColumnChar').show();
             }
          }
      },{
          type: 'column',
          id: "myColumnChar",
          data: [4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8],
          showInLegend: false
        }
       ]
于 2012-11-14T11:50:16.573 回答