Apexcharts.js: Legend Colours not updating

Created on 24 Jan 2019  路  6Comments  路  Source: apexcharts/apexcharts.js

Codepen: https://codepen.io/psambit9791/pen/aXvNwx

Problem:
On changing the stroke color of the line on the chart, the legend does not seem to automatically update the new colors. Moreover, any changes being made to the markers on legend options does not seem to get reflected.

Expected behaviour:
On defining the markers option with the relevant colors (list of colors), the new legend colors should be updated on the chart.

Most helpful comment

You should set the primary colors and everything else will inherit from there. There is no colors property under legend.markers

var options = {
  chart: {
    height: 380,
    width: "100%",
    type: "line"
  },
  colors: ['#C70039', '#17202A']
}

Your updated example - https://codepen.io/apexcharts/pen/VgvaGa

All 6 comments

You should set the primary colors and everything else will inherit from there. There is no colors property under legend.markers

var options = {
  chart: {
    height: 380,
    width: "100%",
    type: "line"
  },
  colors: ['#C70039', '#17202A']
}

Your updated example - https://codepen.io/apexcharts/pen/VgvaGa

Hello, Im with the same problem and your solutiuon didn't work for this. Here you have a CodePen where is occurring the problem. I tried to change the stroke color and it works but I can't change for the legend.

Based on my experience, apex can deal with 5 datasets without any specific color description because it automatically selects the colors from a pre-defined list. Beyond the top five, it repeats the same colors again. In such cases, the specific colors need to be defined within the options.

Check this codepen: https://codepen.io/psambit9791/pen/QWWNjdN

It works! Thank you!

Hello Everyone,

Hope all are doing well.

I have an issue with Apex chart. i need to show maximum 5 legends on chart horizontally as i am having 100s of legends. can anybody please share an example of codepen.

Thanks
CHintesh k.

It Worked!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixalguzman picture felixalguzman  路  3Comments

EroTiXx picture EroTiXx  路  3Comments

georgehardy picture georgehardy  路  3Comments

pribilinskiy picture pribilinskiy  路  3Comments

tcarlsen picture tcarlsen  路  3Comments