Closed cgruber0 closed 4 years ago
If every value is negative, you need to set the option ymax to 0.
Example:
new Morris.Bar({
element: 'yearlyYieldPatternChart',
data: [{"year":"2011","yield":-18.16},{"year":"2018","yield":-16.25}],
ymax: 0,
xkey: 'year',
ykeys: ['yield'],
labels: ['Yield per Year']
});
Then the labels left are quite ugly... is there a option to fix this?
You can try to set the option gridIntegers to true,
or define ymin to a multiple of 4, like -20 for that example.
Setting ymin and ymax helped, thank you very much!
I have a bar chart with 2 negative bars. The y-axis should begin at zero and the bars should be vertically flipped. What am I doing wrong? With another dataset, also completely negative, it works without any problem.
new Morris.Bar({ // ID of the element in which to draw the chart. element: 'yearlyYieldPatternChart', // Chart data records -- each entry in this array corresponds to a point on // the chart. data: [{"year":"2011","yield":-18.16},{"year":"2018","yield":-16.25}], // The name of the data record attribute that contains x-values. xkey: 'year', // A list of names of data record attributes that contain y-values. ykeys: ['yield'], // Labels for the ykeys -- will be displayed when you hover over the // chart. labels: ['Yield per Year'] });