cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Chart type property of iSPC chart dynamically doesn't work

Former Member
0 Kudos

Hi all,

I am trying to set the chart type property (XBAR, MEDIAN etc..) of iSPC chart dynamically from my html page.

This is the code that I used.

var chart_obj = document.iSPCChart.getChartObject();

chart_obj.setChartType("MEDIAN");

iSPCChart is my Applet name.

But the code doesn't seem to work.

The chart is always of the type that I have set in the iSPC display template.

Can someone help me in this regard?

Thanks a lot.

Regards,

M.Subathra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Try using resetChartType("MEDIAN") instead of setChartType.

- Rick

Former Member
0 Kudos

Hi Rick,

It worked!!

Thanks a lot.

Regards,

M.Subathra

Answers (2)

Answers (2)

jcgood25
Active Contributor
0 Kudos

M,

Even though that method shows up in the script assistant and the docs it really doesn't work.

Just swap out the display template for one saved with the desired type:

document.iSPCChart.setDisplayTemplate("Folder/MedianChart");

document.iSPCChart.updateChart(true);

With all of the alarm rules, colors, limits, settings, etc. it is not likely that you will have the same view (display template) that applies to every SPC chart type.

There is also a predelivered example of an SPC Chart that uses an iframe and an irpt to dynamically pass the chart type (along with other settings) you can reference: http://<servername>/Lighthammer/Samples/SPC/Servers.irpt

Regards,

Jeremy Good

Former Member
0 Kudos

Did you try a

document.<applet name>.refresh();

after setting the chart type?