You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by R��mi Aubel <re...@gmail.com> on 2019/10/01 12:59:47 UTC
YAxis with integer values only
Hi,
I would like to configure my Chart's YAxis with these options:
- a given interval (lets say yAxis.interval = 1)
- a start value (yAxis.min = 2.7)
- no max value specified
and I would like to have only integer values on my axis.
Currently, my YAxis has the values 2.7, 3.7, 4.7...
I would like 3, 4, 5...
I guess I can have integer values by using yAxis.splitNumber instead of yAxis.interval, but to define the appropriate value for splitNumber, I need to scan my data to find the max value (then splitNumber would be (max - min) / wantedInterval).
Is there any way to configure ECharts to force integer values on the y axis?
Best regards,
Rémi
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org
Re: YAxis with integer values only
Posted by R��mi Aubel <re...@semarchy.com>.
Hi Wenli,
Thank you for reply.
Indeed, this is a solution, even I'd prefer have the possibility to have an non integer origin (min value) for the YAxis.
Rémi
On 2019/10/04 04:06:09, Ovilia <ov...@gmail.com> wrote:
> Hi Rémi,
>
> I'm afraid to can not use a simple option to force using integer values.
> But when setting the min value, you can use JavaScript to make it into an
> integer (e.g. Math.floor(x * 10) / 10).
> If you need more help, please create an online demo based on
> https://jsfiddle.net/ovilia/n6xc4df3/ .
>
> Thanks
> Wenli
>
>
> On Tue, Oct 1, 2019 at 9:20 PM Rémi Aubel <re...@gmail.com> wrote:
>
> > Hi,
> >
> > I would like to configure my Chart's YAxis with these options:
> > - a given interval (lets say yAxis.interval = 1)
> > - a start value (yAxis.min = 2.7)
> > - no max value specified
> > and I would like to have only integer values on my axis.
> >
> > Currently, my YAxis has the values 2.7, 3.7, 4.7...
> > I would like 3, 4, 5...
> >
> > I guess I can have integer values by using yAxis.splitNumber instead of
> > yAxis.interval, but to define the appropriate value for splitNumber, I need
> > to scan my data to find the max value (then splitNumber would be (max -
> > min) / wantedInterval).
> >
> > Is there any way to configure ECharts to force integer values on the y
> > axis?
> >
> > Best regards,
> > Rémi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
> > For additional commands, e-mail: dev-help@echarts.apache.org
> >
> >
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org
Re: YAxis with integer values only
Posted by Ovilia <ov...@gmail.com>.
Hi Rémi,
I'm afraid to can not use a simple option to force using integer values.
But when setting the min value, you can use JavaScript to make it into an
integer (e.g. Math.floor(x * 10) / 10).
If you need more help, please create an online demo based on
https://jsfiddle.net/ovilia/n6xc4df3/ .
Thanks
Wenli
On Tue, Oct 1, 2019 at 9:20 PM Rémi Aubel <re...@gmail.com> wrote:
> Hi,
>
> I would like to configure my Chart's YAxis with these options:
> - a given interval (lets say yAxis.interval = 1)
> - a start value (yAxis.min = 2.7)
> - no max value specified
> and I would like to have only integer values on my axis.
>
> Currently, my YAxis has the values 2.7, 3.7, 4.7...
> I would like 3, 4, 5...
>
> I guess I can have integer values by using yAxis.splitNumber instead of
> yAxis.interval, but to define the appropriate value for splitNumber, I need
> to scan my data to find the max value (then splitNumber would be (max -
> min) / wantedInterval).
>
> Is there any way to configure ECharts to force integer values on the y
> axis?
>
> Best regards,
> Rémi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
> For additional commands, e-mail: dev-help@echarts.apache.org
>
>