Sign in to follow this  
Brian Maring

get color range from linear gauge

Recommended Posts

Guest Basundhara Ghosal

Hi Brian,

The JavaScript API includes methods for getting the value of a pointer. Is it also possible to use JavaScript to find which ColorRange it is located in?

Please try customizing your code using JavaScript, so that the pointer returns the color-range and not the value.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Brian,

In case you know the value of the color-range, please try creating your own logic to get color-range as the output.

Share this post


Link to post
Share on other sites

Is there a better way to do this? I write the logic for the chart in PHP. I would have to write the logic for getting the color range in JavaScript. I change the logic around quite a bit. It is not the best idea to constantly update parallel logic in both PH and JavaScript.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi Brian,

Could you please send us the sample of the codes that you are using?

Awaiting your reply. :hehe:

Share this post


Link to post
Share on other sites

I'd prefer not to. Let's just say that I have a rather sophisticated PHP program using MySQL queries to calculate the color ranges. I don't want to have to replicate the logic in JavaScript.

Share this post


Link to post
Share on other sites
Guest Madhumita

Hi Brian,

I am afraid, as of now, you can not retrieve the color range for the selected value of the pointer. There is no native support for this.

But, there is always a way with will. Hack!:(

The linear gauge ( as well all charts and gauges in FusionWidgest/FusionCharts pack) being a client side component at the end of the day, allows only JavaScript to interact with it to retrieve values from it. You can not do this directly from PHP once the chart is rendered at the client side browser.

STEPS:

The chart allows you to retrieve the XML from it using getXML() in JavaScript as string.

Using String manipulation/RegularExpression you can retrieve the ranges from the XML.

Using JavaScript you can get the value. Now, you can check whether this value falls under which range and work accordingly.

Please let me know, if this can cater to your needs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this