0

I am using Highcharts5.0.7. I have a pie chart, and on click of its slice, i pass the slice color to another column chart. This colum chart bar colors uses the same color as the selected pie slice color.

My problem

  1. i want the color of the column chart to be filled in gradient. So how can i calculate a standard gradient rgba value based on the color i receive from pie slice?

  2. Secondly, if i print the selected column color of the second chart, it prints as "url(#highcharts-9920sdn-114)" instead of the rgba value. How can i get selected color of column in rgba?

options.colors[0] = {
  "linearGradient": {
    "x1": 0,
    "y1": 0,
    "x2": 1,
    "y2": 0
  },
  "stops": [
    [0, primaryColor],
    [1, primaryColor]
  ]
};
Deep 3015
  • 9,929
  • 5
  • 30
  • 54
ZEE
  • 381
  • 1
  • 6
  • 20
  • 1
    1. It was answered here https://stackoverflow.com/questions/22218140/calculate-the-color-at-a-given-point-on-a-gradient-between-two-colors 2. On point click you have access to this.color which is the point;s color in hex, your can convert it to rgba based from this answer https://stackoverflow.com/questions/21646738/convert-hex-to-rgba – morganfree Jul 19 '17 at 13:03
  • Thanks. When i click on the column of a column chart, i get the value of this.color as "url(#highcharts-p8ux3q8-111". So how can i get rgba value from this url(...) ? – ZEE Jul 20 '17 at 11:28
  • This is the url which references to the gradient element. You wont be able to get the color from it. If you want to get the pixel color under the cursor, you need to calculate it or transform it to canvas and read it https://stackoverflow.com/questions/19836078/to-get-a-rgb-value-for-each-pixel-from-svg-rect-element – morganfree Jul 21 '17 at 11:09

0 Answers0