Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Chart.js scale fix

I have a simeple question about Chart.js, I would like to know how can I fix my chart.

I use Chart.js and respChartJS (https://github.com/arifLogic/respChartJS)

Demo: http://jsfiddle.net/k3YH7/1/

    var data = {
    labels : ["Something #1","Something #2","Something #3"], 
    datasets : [
        {
            fillColor : "rgba(224, 34, 34, 0.5)",
            strokeColor : "#830505",
            data : [1500,1500,1500]
        }
    ]
} 
respChart($("#chart2"),data);

Well, these bars so small and do not work as I expected. How can I make it visible? I want to crate better scale for example: 500, 1000, 1500, 2500 etc.

like image 551
testerius Avatar asked Feb 02 '14 19:02

testerius


1 Answers

For drawing my chart.Line with a fixed Y axis scale, I use this code:

mychart.Line(data,{scaleOverride: true, scaleStartValue: 0, scaleStepWidth: 1, scaleSteps: 30});

This should also work for the chart.Bar object.

like image 157
LM.Croisez Avatar answered Sep 29 '22 07:09

LM.Croisez