How To Get Chart Series data on Button click?

  • 1
  • Question
  • Updated 1 year ago
  • Answered
  • (Edited)
Hi All,

When i click on button then i have need to get chart.series as well as other attribute like chartObj.xAxis, yAxis:chartObj.yAxis etc.

Using before render snippet i am able to get this information using below code:

var chartObj = arguments[0], $ = skuid.$;
console.log(chartObj.xAxis);
console.log(chartObj.yAxis);
console.log(chartObj.seriesxAxis);

But using on click button snippet how can i get this xAxis, yAxis and series data from a chart?
I have assigned a uniquie to chat as "ChartEXG":
Then using that code in snippet for button click  :skuid.$C('ChartEXG').series

But not able get series data.

Can anyone please let me know how i can get chart series and other attribute data on button click.

Thanks,
Raj
Photo of Rajendra Rathore

Rajendra Rathore

  • 1,480 Points 1k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Christine Jessen

Christine Jessen

  • 670 Points 500 badge 2x thumb
Hey Raj!

Thanks for your question -

You're pretty close - in order to grab the chart object similar to what you're getting in the "Before Render" snippet, you're going to have use the function getHCConfig() on click.  This will return the xAxis, yAxis, and series parameters.  Essentially, you want to use the following snippet on button click:
var chart = skuid.$C('ChartEXG').getHCConfig();
console.log(chart.xAxis);
console.log(chart.yAxis);
console.log(chart.series);
Hope this helps!
Christine
(Edited)
Photo of Rajendra Rathore

Rajendra Rathore

  • 1,480 Points 1k badge 2x thumb
@Christine Thank you for your quick reply on this.

Yes that worked and i am able to get the series, xAxis information from chart.
Photo of Josh Merritt

Josh Merritt

  • 918 Points 500 badge 2x thumb
Thanks for this post!

Christine, do you know if it's possible to redraw a chart using a button action?

http://api.highcharts.com/highstock/Chart.redraw

Thanks!
Josh
Photo of Christine Jessen

Christine Jessen

  • 670 Points 500 badge 2x thumb
Josh - you can use the following to redraw a chart:
skuid.$C('CHART_NAME').draw()
You can create a one-line snippet which you can call on a button action.
Photo of Josh Merritt

Josh Merritt

  • 918 Points 500 badge 2x thumb
Thanks Christine!

Is there somewhere that I can find the commands available via the skuid. syntax for highcharts?