2016-01-20 24 views
0

我想将higcharts数据导出为ex​​cel。我能够做到这一点唯一的问题是我想出口字符串以及数据。但是,highcharts不会将字符串导出为数据值,并且在Excel表格中它将返回undefined。将excel中的Highcharts数据以字符串的形式导出

$(function() { 
    // Create the chart 
    var options1 = 
     { 

      chart: { 
       renderTo: 'container0', 
       borderColor: '#dddddd', 
       borderWidth: 1, 
       borderRadius: 10, 
       type: 'column', 
       spacingBottom: 20, 
       spacingTop: 20, 
       spacingLeft: 20, 
       spacingRight: 20, 
       width: 378, 
       height: 237, 
       // backgroundColor: 'blue' 
      }, 

      navigation: { 
       buttonOptions: { 
        verticalAlign: 'top', 
        y: -9, 
        x: 15, 
        symbolSize: 10, 
        symbolHeight: 30, 
        symbolStrokeWidth: 0, 
        strokeWidth: 0, 
        theme: { 
         fill: 'black', 
         zIndex: 6 
        }, 
        ry: 5, 
        rx: 5 
       } 
      }, 


      credits: { 
       enabled: false, 
       text: 'Only top 10 records displayed', 
       position: { 
        align: 'right', 
        y: -5 

       }, 
       href: "javascript:void(0)", 
       style: { 
        fontSize: '10', 
        cursor: "normal" 
       } 
      }, 

      exporting: { 
       sourceWidth: 480, 
       sourceHeight: 300, 
       scale: 1 
      }, 


      title: { 
       style: { 
        'fontSize': '1em' 
       }, 
       useHTML: true, 
       x: -27, 
       y: 8, 
       text: null 
      }, 

      xAxis: { 
       name: "Fruit", 
       categories: ['11/15/2015','11/22/2015','11/29/2015','12/6/2015','12/13/2015','12/20/2015','12/27/2015'] 
        }, 

       labels: { 
        style: { 
         fontSize: '9px' 
        } 
       }, 


      yAxis: { 
       title: { 
        text: '' 
       }, 
       min: 0, 
       max: 150, 
       tickInterval: 20, 
      }, 
      legend: { 
       enabled: false 
      }, 
      plotOptions: { 
       series: { 
        borderWidth: 0, 
        dataLabels: { 
         enabled: true, 
         style: { 
          fontWeight: 'normal', 
          color: 'grey' 
         }, 
         format: '{point.y}', 
        }, 
        shadow: { 
         width: 5, 
        } 
       } 
      }, 

      tooltip: { 
       headerFormat: '<span style="font-size:11px">{series.name}</span><br>', 
       pointFormat: '<span style="color:{point.color}">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>' 
      }, 

      series: [{ 
       name: 'Accounts Reached', 
       color: { 
        linearGradient: { x1: 1, x2: 1, y1: 1, y2: 0 }, 
        stops: [ 
         [0, '#12486d'], 
         [1, '#279ef2'] 
        ] 
       }, 
       pointWidth: 30, 
       data: [19, 132, 25, 28, 82, 1, 1], 
       visible:false 
      }, { 
       name: 'Week', 
       color: { 
        linearGradient: { x1: 1, x2: 1, y1: 1, y2: 0 }, 
        stops: [ 
         [0, '#12486d'], 
         [1, '#279ef2'] 
        ] 
       }, 
       visible:false, 
       pointWidth: 30, 
       data: [19, 132, 25, 28, 82, 1, 1] 
      }, { 
       name: 'Leads', 
       color: { 
        linearGradient: { x1: 1, x2: 1, y1: 1, y2: 0 }, 
        stops: [ 
         [0, '#12486d'], 
         [1, '#279ef2'] 
        ] 
       }, 
       pointWidth: 30, 
       data: [19, 166, 39, 37, 107, 1, 1] 
      }, { 
       name: 'Campaign ID', 
       color: { 
        linearGradient: { x1: 1, x2: 1, y1: 1, y2: 0 }, 
        stops: [ 
         [0, '#12486d'], 
         [1, '#279ef2'] 
        ] 
       }, 
       pointWidth: 30, 
       data: [18223, 18223, 18223, 18223, 18223, 18223, 18223], 
       visible:false 
      }, { 
       name: 'week start2', 
       color: { 
        linearGradient: { x1: 1, x2: 1, y1: 1, y2: 0 }, 
        stops: [ 
         [0, '#12486d'], 
         [1, '#279ef2'] 
        ] 
       }, 
       pointWidth: 30, 
       data: ["Mon", "Mon", "Mon", "Mon", "Mon", "Mon", "Mon"], 
       visible: false 
      } 

      ] 
     } 

    var chart = new Highcharts.Chart(options1); 
}); 

我不希望显示在图表上的字符串数据我唯一的要求是多列导出Excel中可能包含数据串也。

回答

0

Defaulty您的图表不打印此系列(带文本),因为Highcharts需要数字值(不支持字符串作为数据)。因此出口也不打印这些点。

+0

所以,你可以请建议我该怎么做才能做到这一点?我正在尝试几天。 –

相关问题