1

How can I get in javascript the color scales defined in the variable scales in https://github.com/plotly/plotly.js/blob/master/src/components/colorscale/scales.js?

I inspected the Plotly object in debugger console, but I can't find the attributes.

2 Answers2

1

as far as I can tell by the way the project is bundled, if you are using the release version of the project (like the one in the CND or the dist folder) you cannot access them, because they are only defined directly in the function that uses them. So they are not exposed in any property or anything. (see image from the bundled file below)

enter image description here

Note: As mentioned in @Aifos answer, it was available but since version 2, Plotly no longer exposes .d3 property so if you use last version you will get an error

If you need them I'd recommend you to simply import the file yourself from the src file

Daniel Cruz
  • 1,437
  • 3
  • 5
  • 19
0

Does the below help you?

Plotly.d3.scale.category10();

As mentioned here: https://stackoverflow.com/a/40677409/19135131

Aifos Si Prahs
  • 343
  • 1
  • 9