2014-02-20 48 views
0

我正在創建具有大數據變化的高圖表,因爲高圖表不顯示最小數據我使用日誌來更改數據在這裏是我的代碼其工作正常,但y軸doesn'牛逼工作正常這裏的鏈接http://jsfiddle.net/rutup/6hxPU/高圖與大變量數據和動態創建y軸

function createBarChart(source, title, placeHolderId, sideText, xColumnValue) { 
Highcharts.setOptions({ 
    colors:["#1f77b4", "#ff7f0e", "#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f", "#bcbd22", "#17becf"]// ["#4572a7", "#aa4643", "#89a54e", "#80699b"] 
}); 
$('#' + placeHolderId).highcharts({ 
    credits: { enabled: false }, 
    chart: { 
     type: 'column' 
    }, 
    exporting: { enabled: false }, 
    title: { 
     text: title 
    }, 

    xAxis: { 
     categories: xColumnValue 
    }, 

    legend: { 
     layout: 'vertical', 
     align: 'right', 
     verticalAlign: 'top', 
     borderWidth: 0 
    }, 
    yAxis: { 
     min: 0, 
     // tickInterval: 
     lineWidth: 1, 
     gridLineWidth: 0, 
     title: { 
      text: sideText 
     }, 
     stackLabels: { 
      enabled: true, 
      style: { 
       fontWeight: 'bold', 
       color: 'gray' 
      } 
      , formatter: function() { 
       return this.y; 
      } 
      //, formatter: function() { 
      // return calcTotalAntiLog(this.total);//this.total; 
      //} 
     } 
    }, 
    tooltip: { 
     formatter: function() { 
      return '<b>' + this.x + '</b><br/>' + 
       this.series.name + ': ' + calcAntiLog(this.y) //+ '<br/>' +//calcAntiLog(this.y) 
      // 'Total: ' + calcAntiLog(this.point.stackTotal);//calcAntiLog(this.point.stackTotal) 
     } 
    }, 
    plotOptions: { 
     column: { 
      stacking: 'normal', 
      dataLabels: { 
       color: 'white', 
       enabled: true, 
       formatter: function() { 
        return calcAntiLog(this.y); 
       } 
      } 
     } 
    }, 
    series: source 
}); 

} 
+1

好了,我在你的一系列目標看4點,4列的顯示,這樣有什麼不好? –

+0

@Rutu,你可以在文字上加點標點符號嗎?對不起,但你應該花費至少幾秒來發送之前格式化你的文本.. –

+0

@ Sebastian Bochan很好,它顯示了4點,看看y軸的數據和間隔它顯示5爲最大,而實際最大數據是100我想根據我的數據設置y軸數據間隔 – Rutu

回答

1

你試試用數軸,讓highcharts計算日誌? 在Y軸設置中設置type: 'logarithmic' 我已經修改了你的小提琴顯示,在行動http://jsfiddle.net/6hxPU/7/