Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › Pivot/grouping + charting question › Reply To: Pivot/grouping + charting question
Hi,
I understand the parameters of the smartChart object/class but what I wanted to know was if it was possible to dynamically assign the type. Here is an example of what I would like to do:
function process_selection(chart_type){
// assume this function gets the grid’s selection and processes the data so that it can be used for charting – i.e the code inside the chart’s onclick in your codepen.
//how can I use the chart_type variable here to change the properties of the already defined window.Smart("#pivot-chart",...) ? (since this is what we are using to draw on)
//the obvious solution is to re-define the entire smart object with the new chart type – but this seems suboptimal – am I understanding the concept of smart objects correctly?
}
With this function, I can assign to onClick on different chart types:
process_selection('line')
process_selection('bar')
etc.,