apexcharts / react-apexcharts

📊 React Component for ApexCharts
https://apexcharts.com
MIT License
1.31k stars 156 forks source link

Static Range On Axis Options #143

Closed RomanStadlhuber closed 1 month ago

RomanStadlhuber commented 4 years ago

I am implementing a Bar Chart to show values fluctuating between -1 and 1.

The data (series) gets passed as a prop to the component as it retrieved from an Apollo Cache, which eliminates the need to manually fetch data at a specified interval.

As I have mentioned, I know beforehand my data will range from -1 to 1, hence I passed my axis options as follows.

xaxis: { categories, min: -1, max: 1 }

My Problem

however, when I display my data and it does not reach the full extent of the range, the visual range of the chart is dynamically updated (see footage below). Bar_Problem

What I Need

I need the bar chart to always show the full range of -1 to +1, regardless of the max/min data values. This way the "center point" of zero should also not move just like it does in the example.

How would I go on about fixing this issue?

If more source code is required, please let me know. I have spared out all else as I believe the range to be the only related option to my problem.

gabrielbeauchemin commented 4 years ago

I have the same problem, please fix it. It is because because, when only the series change, chart.updateSeries (react-apexcharts.jsx line 126 at the moment of this comment) is called, which does not apply the options. So the min and max are not considered, the chart zoom on the selected data.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.