2015-12-12 43 views
1

我正在通過ecpm,因爲您可以在下面看到[「0.4」,「0.2」,「0.6」,「0.3」]作爲y軸的數據,以在多軸圖形上繪製樣條曲線,使用highcharts。但它繪製樣條線作爲考慮的值作爲提示,每點價值爲0的直線水平線也即將爲0Highcharts將十進制值舍入爲0.如何避免它?

以下是使用腳本:

$('#dual-axes-line-and-column4').highcharts({ 
       chart: { 
        zoomType: 'xy' 
       }, 
       title: { 
        text: 'Some Matrix' 
       }, 
       subtitle: { 
        text: '' 
       }, 
       xAxis: [{ 
        categories: perfCategoriesStr 
       }], 
       yAxis: [ 
        { // Primary yAxis 
        labels: { 
         format: '{value}', 
         style: { 
          color: '#89A54E' 
         } 
        }, 
        title: { 
         text: 'Views', 
         style: { 
          color: '#89A54E' 
         } 
        }, 
        opposite:false 
       }, { // Secondary yAxis 
        title: { 
         text: 'Revenue in $', 
         style: { 
          color: '#4572A7' 
         } 
        }, 
        labels: { 
         format: '{value}', 
         style: { 
          color: '#4572A7' 
         } 
        }, 
        opposite: true 
       }, { // Secondary yAxis 
        title: { 
         text: 'eCPM in $', 
         style: { 
          color: '#4572A7' 
         } 
        }, 
        labels: { 
         format: '{value}', 
         style: { 
          color: '#4572A7' 
         } 
        }, 
        opposite: true 
       }], 
       tooltip: { 
        shared: true 
       }, 
       legend: { 
        layout: 'vertical', 
        align: 'left', 
        x: 70, 
        verticalAlign: 'top', 
        y: 10, 
        floating: true, 
        backgroundColor: '#FFFFFF' 
       }, 
       series: [{ 
        name: 'Views', 
        color: '#4572A7', 
        type: 'column', 

        data: views, 
        tooltip: { 
         valueSuffix: ' views' 
        } 

       }, { 
        name: 'Revenue', 
        color: '#89A54E', 
        type: 'spline', 
        yAxis:1, 
        data: revenue, 
        tooltip: { 
         valuePrefix: '$ ' 
        } 
       }, { 
        name: 'eCPM', 
        color: '#000000', 
        type: 'spline', 
        yAxis: 1, 
        data: ecpm, 
        tooltip: { 
         valuePrefix: '$ ' 
        } 
       }] 
      }); 
+1

你也可以發佈在高樓代碼?可能的選項參數? –

+0

感謝@Omkar提出。 –

回答

1

就想通了。傳遞的值應該是一個數字而不是一個字符串。它的工作正常,如果我們在數組中傳遞javascript數字而不是字符串,就像您在問題中看到的那樣。