Home Forums Chart Support Render Chart only when itemClick is clicked Reply To: Render Chart only when itemClick is clicked

#33922

@wellhys,

You can render the second chart on clicking datapoints from the first chart using conditional rendering and react state. Please take a look at the code snippet below.

{this.state.clicked && <CanvasJSChart
  options={options} 
/>}

Also, check out this StackBlitz for an example with complete code.

Render the second chart on datapoint click in React

Considering this thread as duplicate of React itemClick with Boolean (JSFiddle given) and hence closing the same.

—-
Manoj Mohan
Team CanvasJS