Sanandh C k Posted April 19, 2021 Share Posted April 19, 2021 I am trying create the gauge chart in Spotfire using javascript and html. I used an existing script which is aviable in google and every script the target values are static. Is there any way to make the target values are dynamic. the script i used ,calculated value: Edited : Please see the attached dxp and also the chart shows empty values when we open the dashboard. calculated value: $(document).ready(function(){ var myvar=setTimeout(changeGuage,10); }); function changeGuage(){ val4=document.getElementById('calcValue'); Target=document.getElementById('Target'); ActualTarget=parseInt(Target.innerText); intTile4Value = parseInt(val4.innerText); var js0 = "//cdn.jsdelivr.net/raphael/2.1.0/raphael-min.js"; var js1 = "//cdn.jsdelivr.net/justgage/1.0.1/justgage.min.js"; var scripts = [js1, js0]; function initGage() { var g = new JustGage({ id: "gauge", value: intTile4Value, min: 0, max: ActualTarget, title: "Active Players", label: "Current Month", levelColors: ['#ff0000', '#ffff00', '#00fff00'] }); $(calcValue).on('DOMSubtreeModified',function(){ g.refresh($(this).text()) }) $(Target).on('DOMSubtreeModified',function(){ g.refresh($(this).text()) }) } function getNextScript() { if (scripts.length === 0) { initGage(); } else { $.getScript(scripts.pop(), getNextScript); } } getNextScript();} Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 19, 2021 Share Posted April 19, 2021 Hi Sanandh, Have you had a look at the JSViz package on the TIBCO Exchange sitehttps://community.spotfire.com/modules/jsviz-javascript-visualization-frame.... There is a Gauge chart in there, which you coudl use as an example. And maybe that one does the dynamic targeting that you want. Also, in Spotfire 11, you should be able to create a Gauge chart based on a 'mod' (maybe that is what you were actually doing already). Kind regards, David Link to comment Share on other sites More sharing options...
Sanandh C k Posted April 19, 2021 Author Share Posted April 19, 2021 Hi David, I dont have JZViz in my analyst and I created the gauge chart using Javascript. I am unable to change the property and dymanic max value. Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 20, 2021 Share Posted April 20, 2021 Hi Sanandh, Could you share the dxp file, so we can have a look at it Kind regards, David Link to comment Share on other sites More sharing options...
Sanandh C k Posted April 21, 2021 Author Share Posted April 21, 2021 Hi David, I have attached the chart with my question. Thanks, Sanandh Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 22, 2021 Share Posted April 22, 2021 Hi Sanandh, I see what you mean. Have a look at the attached Gauges.dxp. In there you will find a couple of examples. The Revenue gauge on the first page, has a dynamic target in it, all other gauges have a fixed min and max. I have used the same calculated value for the Revenue gauge, so the revenue value will always be the same as the target value. But you can change that for another calculated value of course. Kind regards, David Link to comment Share on other sites More sharing options...
Pablo Zornoff Posted September 7, 2022 Share Posted September 7, 2022 Hello David! I cannot find the attachment. Would you mind sending me this email?pzornoff@magellan-cg.com.Thanks Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted September 8, 2022 Share Posted September 8, 2022 Hello Pablo,Please find attached the Gauges.dxp. I think it must have been deleted when we moved to the new Community.Kind regards,David Boot-Olazabal Link to comment Share on other sites More sharing options...
Pablo Zornoff Posted September 8, 2022 Share Posted September 8, 2022 Thanks a lot David Link to comment Share on other sites More sharing options...
Vivek Kumar 10 Posted September 21, 2022 Share Posted September 21, 2022 With recent updates, Visualization Mods are already addressing this - https://www.tibco.com/resources/community/gauge-mod In case, Visualization mods are not available to you yet - you can use Python visuals in Spotfire as well. Below links will help you in this case -Steps to implement : Code : https://plotly.com/python/gauge-charts/ Link to comment Share on other sites More sharing options...
Kinimod24 Posted August 9 Share Posted August 9 @David Boot-Olazabal Hello David, Do you have the Gauges.dxp attachement? Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted August 26 Share Posted August 26 Hi Kinimod, I believe it is the attached one. Kind regards, David Gauges.dxp Link to comment Share on other sites More sharing options...
Kinimod24 Posted August 26 Share Posted August 26 @David Boot-Olazabal thank you for that! is there an easy way to add a needle to it and target marker? I downloaded the spotfire gauge mod and it works fine but is very limited. 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