apexcharts / react-apexcharts

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

Multi-series color support for stroke in bar charts #587

Closed Digvijayrao-KF closed 7 months ago

Digvijayrao-KF commented 7 months ago

Hi,

Similar to a functional support provided for colors (ref: link) is there a way to utilize the same for applying stroke colors via a function.

Requirement:

For 2nd series, I need to apply border colors to the paths/bar based on values driven on y-axis image

Usage:

Have been trying this code for the same. (seriesIndex & value is required to apply the logic)

stroke: {
    show: true,
    width: 2,
    colors: [
      function ({ value, seriesIndex, w }) {
        if (seriesIndex == 1) value < 3.6 ? "#54A0FF" : "#FFC759";
      },
    ],
    dashArray: 0,
 } 

Package versions used

"apexcharts": "3.45.2",
"react-apexcharts": "^1.4.1",
"react": "^17.0.2",

Discussions: Older ref-2813

Digvijayrao-KF commented 7 months ago

Added the same in apexcharts github repo click here