Dashboards & Visualizations

How to change charting.fieldColors through JS

chanmi2
Path Finder

Hi all,

Setting "charting.fieldColors" in XML always works, but it failed when I try to change this value through js.
My code is like this:

var chartview = mvc.Components.get("chartid");
chartview.settings.set("charting.fieldColors",'{"sth":0x65a637}');
// tried call network.render(); already

Is there any way to change fieldColors through JS? Thanks.

0 Karma
1 Solution

kbarker302
Communicator

Using your example, this worked for me:

chartview.options["charting.fieldColors"]='{"sth":0x65a637}';

View solution in original post

kbarker302
Communicator

Using your example, this worked for me:

chartview.options["charting.fieldColors"]='{"sth":0x65a637}';

chanmi2
Path Finder

thanks @kbarker302! this is worked when the chartview.visualization is still null. Do you have any idea of applying this after visualization is built? (Again, adding network.render() does not work.)

Thanks a lot!

seva98
Path Finder

@chanmi2 it is been already 3 years but do you have any idea if you can share the solution to applying this after visualization is built?

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...