bbonnin / vue-morris

VueJS component wrapping Morris.js
MIT License
237 stars 36 forks source link

Malfunction in display negative values #10

Closed Julian367 closed 6 years ago

Julian367 commented 6 years ago

Hello, It seems that the bar graph on several negative values is wrong.

"testChart": [
{
"totalProfit": -956,
"month": "January"
},
{
"totalProfit": -400,
"month": "February"
}
],

screenshot-2018-2-5 http cota2 test

Julian367 commented 6 years ago

Can you please tell me if I'm doing something wrong or is a bug? Thank you.

bbonnin commented 6 years ago

Can you provide more details about the configuration of the chart ? Thanks !

Julian367 commented 6 years ago
<bar-chart
                id="bar" :data="testChart" xkey="month" ykeys='[ "totalProfit"]' resize="true"
                labels='[ "Total profit"]' :bar-colors="osColor"
                grid="true" grid-text-weight="bold" hide-hover="auto">
</bar-chart>
bbonnin commented 6 years ago

Hello, I have updated the component: the last version (0.0.13) includes a fix for your problem. Your problem only occurs if all values are negative. If your are sure that you have only negative values, just add a new attribute: ymax="0" This will force the bar chart to star the y axis to start at 0. You will get somthing like this: vue-morris-negative-values

Julian367 commented 6 years ago

Hello,

Attribute ymax="0" is doing the trick for all negative values but I have situation when I have negative and positive values and this thing is not gone work. Can be implement as function when all the values are negative to bind this attribute ymax="0"?

Thank you