Search Support
-
RameshkumarSeptember 25, 2015 at 11:57 am #759
Hi Team,
I was looking into your chart tutorials and examples. I am wondering, how do I pass the input to the AJAX service.
<span style=”text-decoration: underline;”>Requirement</span>
when user choose the month from select control, selected month data will be shown in the pie chart.
I am not sure, how to call and pass the input to the Ajax service. Could you please provide some steps to achieve the same ?
RameshkumarSeptember 28, 2015 at 7:06 am #764Team,
Could any one look into this and update me ?
Regards,
RameshSeptember 29, 2015 at 8:52 am #778Hi Ramesh,
There is no configuration option for the chart, specifically for the pie chart, to include the input variable into the ajax service. However, you can try the Service Call.
Thank you,
Lisa Leung
RameshkumarSeptember 29, 2015 at 8:56 am #779Hi Lisa,
Could you give me a small example how to use service call in chart? Based on user input, I have to fetch the data from DB to show in the chart.
it can be either pie or bar chart.
Regards,
Ramesh
jmacSeptember 29, 2015 at 1:15 pm #782Ramesh:
IF you want to pass data to the AJAX service, you will need to use the chart’s setQueryData() method. In your original post you indicated that you would be getting the value from a select control. what you would want to do is to put code like the following in your chart’s On Load event.
me.setQueryData(${SelectMonth}.getSelectedValue());
Note: this assumes your select has a control id of SelectMonth.
Now in your service the value is accessed using tw.local.data.
This will work, but when testing I found an issue with the Chart logic and spoke with the developer so this bug will be fixed in the next release. If you try this prior to the next release it will fail.
I hope this helps.
JMAC
jmacSeptember 30, 2015 at 7:03 am #783NOTE: In the above the method specified as getSelectedValue should be getSelectedItem.
Sorry for any confusion
JMAC
Vignesh DhakshinamoorthyJune 27, 2016 at 11:21 am #2241This post helped me well today, thanks Jmac for updating the correct syntax to use getSelectedItem method.
In my case, I had to pass a value of a single select drop down as input to my line chart’s Ajax service. I wrote the following in onChange event of the Single select.
${Line_Chart_SDS2}.setQueryData(me.getSelectedItem()); ${Line_Chart_SDS2}.refresh()
I also updated the data type of my Ajax input variable from Any to String. Then I was able to pass inputs and produce dynamic charts.
-
|
You must be logged in to reply to this topic.