How to retrieve information about the chart bar that was clicked on Intraweb IWChartJS?

48 Views Asked by At

How can we start a new Intraweb application as below:

procedure TIWForm25.IWAppFormCreate(Sender: TObject);
begin
  IWChartJS2.MainSeries.Add([7,8,8,9,9,9,10,11,14,14,15]);
  IWChartJS2.Labels.Add([50,60,70,80,90,100,110,120,130,140,150]);
  IWChartJS2.MainSeries.Colors.Add([clWEBBlue]);
  IWChartJS2.ChartType := ctLine;
  IWChartJS2.Legend.Visible := True;
  IWChartJS2.Legend.Title.Text := 'Sample data';
  IWChartJS2.Legend.Position := tpBottom;
  IWChartJS2.Title.Text := 'This is a line chart';
  IWChartJS2.Title.Visible := True;
end;

And click the bars displayed by the chart to retrieve some data?

By assigning a procedure to the chart like this: IWChartJS2.OnAsyncClick := ChartAsyncClick;

procedure TIWForm25.ChartAsyncClick(Sender: TObject; EventParams: TStringList);
var idx: string;
begin  
  idx := EventParams.Values['y'];
end;

we can get values of coordinates working, but how can we access other data such as get the chart bar that was clicked? Or its index so we can return some relative information?

The goal is to return some information about the bar that was clicked such as opening a new window to display something related or update another chart.

0

There are 0 best solutions below