FVANCOP / ChartNew.js

MIT License
420 stars 143 forks source link

leftScaleStepWidth depending on bar data value #485

Closed luna2761 closed 7 years ago

luna2761 commented 7 years ago

Hello, Francois!

I have bar chart with endDrawDataFunction and two scaleOverride. The problem is I can't use some unique value as I want to have reusable function for creating charts with different data values for bars. Please, advice, can we somehow make leftScaleStepWidth = auto? So the value will be automatic according to biggest bar data value?

Thank you.

FVANCOP commented 7 years ago

Hi,

Unfortunately, the "auto" (or similar) value is not available for leftScaleStepWidth.

Currently busy with a new add-ins for issue #460; As soon it is published, I will check how to solve this issue.

Regards, François

FVANCOP commented 7 years ago

Hi,

Has promised, the code has been updated; With the new code, you can specify new options that makes the definition of the y axis more flexible.

@luna2761 : Is this solution sufficient for your problem ?

Regards, François

-> forceGraphMin and forceGraphMax : (see https://github.com/FVANCOP/ChartNew.js/wiki/100_070_Charts_Layout#forcegraphmax)

When option graphMin (resp: graphMax) is specified, the minimum (resp:maximum) value of the Y axis is set by the value associated to graphMin (resp:graphMax) even if the minimum (resp: maximum) value to be displayed is lower (resp: greater) that this value. Is you set option forceGraphMin (resp:forceGraphMax) to false (default value is true), the minimum (resp:maximum) value of the axis will at most (resp:least) the value of graphMin (resp:graphMax) but will be lower (resp:greater) if the minimum (resp: maximum) of the value to be displayed is lower (resp:greater) than graphMin (resp:graphMax).

-> forceScale (see https://github.com/FVANCOP/ChartNew.js/wiki/100_030_Axis#forcescale )

When scaleOverride option is set to false (which is the default value for this option), the Y Scale layout (minimum value, maximum value, number of steps and step width) is computed by the application. The minimum and the maximum values can be forced through options graphMin and graphMax options. If you want to force the number of steps or the stepWidth, you can specify it through option forceScale. If option forceScale is set to "steps", the number of steps for the y axis is defined by the value of option scaleSteps (=> If you set option forceScale to "steps", do not forget to also define a value for option scaleSteps !). If option forceScale is set to "stepWidth", the width of the steps for the y axis is defined by the value of option scaleStepWidth (=> If you set option forceScale to "stepWidth", do not forget to also define a value for option scaleStepWidth !).

luna2761 commented 7 years ago

Hi, François,

I've used calculated graphMin and graphMax values. This helped. Generally it's really much more flexible now,

Thank you!