Highcharts, Can you change the chart type for drilldowns?

前端 未结 3 528
旧巷少年郎
旧巷少年郎 2021-01-03 06:32

Highcharts, Can you change the chart type for drilldowns?

I would like to present a standard \"column\" chart initially and then drilldown to a \"bar\" chart, I have

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-03 06:58

    Well, I think it's enought if you define each serie's type

    $(function () {
    // Create the chart
    Highcharts.chart('container', {
        title: {
            text: 'Browser market shares. January, 2015 to May, 2015'
        },
        subtitle: {
            text: 'Click the columns to view versions. Source: netmarketshare.com.'
        },
        xAxis: {
            type: 'category'
        },
        yAxis: {
            title: {
                text: 'Total percent market share'
            }
    
        },
        legend: {
            enabled: false
        },
        plotOptions: {
            series: {
                borderWidth: 0,
                dataLabels: {
                    enabled: true,
                    format: '{point.y:.1f}%'
                }
            }
        },
    
        tooltip: {
            headerFormat: '{series.name}
    ', pointFormat: '{point.name}: {point.y:.2f}% of total
    ' }, series: [{ name: 'Brands', type: 'column', colorByPoint: true, data: [{ name: 'Microsoft Internet Explorer', y: 56.33, drilldown: 'Microsoft Internet Explorer' }, { name: 'Chrome', y: 24.03, drilldown: 'Chrome' }, { name: 'Firefox', y: 10.38, drilldown: 'Firefox' }, { name: 'Safari', y: 4.77, drilldown: 'Safari' }, { name: 'Opera', y: 0.91, drilldown: 'Opera' }, { name: 'Proprietary or Undetectable', y: 0.2, drilldown: null }] }], drilldown: { series: [{ type: 'line', name: 'Microsoft Internet Explorer', id: 'Microsoft Internet Explorer', data: //your drill data }, { name: 'Chrome', id: 'Chrome', data: //your drill data }, { name: 'Firefox', id: 'Firefox', data: //your drill data }, { name: 'Safari', id: 'Safari', data: //your drill data }, { name: 'Opera', id: 'Opera', data: //your drill data }] } });

    http://jsfiddle.net/ffc4jhb7/

    Best regards

提交回复
热议问题