apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js
https://apexcharts.github.io/Blazor-ApexCharts
MIT License
788 stars 91 forks source link

How to: dynamically assign min or max yaxis value? #495

Open rudischilder opened 1 month ago

rudischilder commented 1 month ago

Hello. I am trying to dynamically ensure that the lowest value displayed in the y-axis is either a value of my choice, or whatever is the lowest value in every dataset provided to the chart.

However, i am running into issues with how to assign functions to the options, specifically options.Yaxis.Min.

From what I can tell, there is a JSON parser that should translate whatever I want to the apexcharts.js, but I am not familiar with the ins and outs of that method, or what exactly is possible with JavaScript & ApexCharts.js.

As an example of what I was trying to do:

options.Yaxis = [new YAxis
    {
        Title = new AxisTitle { Text = "Temperature ℃" },
        DecimalsInFloat = 1,
        Min = (double x) => (Math.Min(x, 18.0)),
    }];

Can someone provide an example of how this could be achieved? Or a link to documentation that I likely missed?

joadan commented 2 weeks ago

Hi,

Sorry but the function you can provide is an javascript function, this is part of the apexcharts.js functionality. https://apexcharts.com/docs/options/yaxis/

I will update the documentation to make this clear.