Home Forums Chart Support color Variables for dataSeries

color Variables for dataSeries

Viewing 3 posts - 1 through 3 (of 3 total)
  • #43595

    I want the colors inside the chart to be based on the colors created in my root and I value it with var(–bg-root1) but it doesn’t work.
    Please help me.

    • This topic was modified 1 year, 4 months ago by Shiva002.
    #43597
    #43607

    @shiva002,

    The color property accepts RGB, hex-code, and color-names as of now. However, you can get CSS variable value in JavaScript using getComputedStyle() as shown in the code snippet below.

    function getCSSVarValue(name) {
        return getComputedStyle(document.getElementById('chartContainer')).getPropertyValue(name);
      }

    Please check this JSFiddle for a working example.
    __
    Rohith Nagaral
    Team CanvasJS

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.