如何在导出时添加xAxis日期格式的年份?还有如何在导出过程中添加数据源?

时间:2015-08-12 04:33:11

标签: javascript html angularjs highcharts highstock

我希望在导出选项时以 xAxis 比例添加年份。我试过这段代码,它在 jsfiddle 中工作得很好,但在我的本地没有。

$(function () {
    $('#container').highcharts({
        exporting: {
            chartOptions: { // specific options for the exported image
                plotOptions: {
                    series: {
                        dataLabels: {
                            enabled: true
                        }
                    }
                },
                title: {
                    text: 'export Title'
                },
                 xAxis: {
                        type: 'datetime',
                        dateTimeLabelFormats: {
                            millisecond: '%b %e %Y',
                            second: '%b %e %Y',
                            minute: '%b %e %Y',
                            hour: '%b %e %Y',
                            day: '%b %e %Y',
                            week: '%b %e %Y',
                            month: '%b %e %Y',
                            year: '%b %e %Y'
                        }
                    },
            },
            scale: 3,
            fallbackToExportServer: false
        },
        title: {
            text: 'Offline export'
        },
        subtitle: {
            text: 'Click the button to download as PNG/SVG'
        },  
        chart: {
            type: 'area'
        },
        xAxis: {
           type:'dateTime'
        },
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 126.0, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
});

此外,我尝试在导出选项中添加数据源,是否有任何解决方案。

以下是jsfiddle

1 个答案:

答案 0 :(得分:0)

您可以按chartOptions

配置导出的图表