Byron Kelly Posted August 1, 2018 Share Posted August 1, 2018 Hi All I am trying to create a Gauge Chart in my Spotfire Analyst project. I have no prior experience using Java Script or HTML code so I am struggling here. I am trying to link the Gauge Chart to the data in my project, so that when I mark a table/chart, the Gauge Chart will update with revelant data related to the marking. I have implemented a basic gauge chart based on code I found here : http://spotfired.blogspot.com/2016/03/custom-gauge-from-calc-value-70.html This plots a static gauge chart, using a static number (#22 for 'visitors'); I would like to change the static number to a number based on my data. 1) How do I link the Gauge Chart to a calculated column in my dataset 2) How do I enable it to updated based on marking my data I tried to modify the code and replace the #22 'value' with the name of the Calculate Column i want to chart, but it did not work. I am trying to plot a % (one number divided by another, in this case production/capacity) Here is what my modified JS looks like (which does not work) html calculated value: js resource=[ "//cdn.jsdelivr.net/raphael/2.1.0/raphael-min.js", "//cdn.jsdelivr.net/justgage/1.0.1/justgage.min.js" ] //add scripts to head $.getScript(resource[0],function(){ $.getScript(resource[1],init) }) init = function(){ var g = new JustGage({ id: "gauge", value: "Production/Capacity", min: 0, max: 1.00 title: "Visitors" }); //refresh gauge when calcvalue changes $(calcValue).one('DOMSubtreeModified',function(){ g.refresh($(this).text()) }) }Any help would be GREATLY appreciated. Thanks! Byron Link to comment Share on other sites More sharing options...
Stu Blair Posted August 13, 2018 Share Posted August 13, 2018 There's an example of a gaugechart in the data quality dashboard found on the following page: https://community.spotfire.com/wiki/tibco-spotfire-user-group-tips-tricks-u... Link to comment Share on other sites More sharing options...
Shandilya Peddi Posted August 13, 2018 Share Posted August 13, 2018 Check the attached sample gauge chart with modified JS that reacts based on the calculated value change Link to comment Share on other sites More sharing options...
Per Kurcman Posted May 26, 2020 Share Posted May 26, 2020 Shandilyas example sometimes failsin 10.0.0 and later versions of Spotfire. I'm attaching a modifiedexample where aMutationObserver is added, listening to two calculated values, and set the value and color of the gaugedepending on those two calculated values. Link to comment Share on other sites More sharing options...
Kinimod24 Posted August 9 Share Posted August 9 @Per Kurcman Hi Per, can you please share your modified example? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now