Hi,
I have a chart like the one in the attached image, this is the code:
I am trying to use the MouseDown event to do something like show an alert with bar info or open a new window and pass it data from that bar that I am clicking.
How can I obtain the data of the bar that I am clicking?
It is ok to use that event or should I use another one?
Thanks,
Alberto
I have a chart like the one in the attached image, this is the code:
<
telerik:RadCartesianChart
Name
=
"CartesianChartDemo"
Margin
=
"10"
>
<
telerik:RadCartesianChart.Behaviors
>
<
telerik:ChartPanAndZoomBehavior
PanMode
=
"Both"
ZoomMode
=
"Both"
/>
</
telerik:RadCartesianChart.Behaviors
>
</
telerik:RadCartesianChart
>
CartesianChartDemo.VerticalAxis =
new
LinearAxis();
CartesianChartDemo.HorizontalAxis =
new
CategoricalAxis();
CartesianChartDemo.Grid =
new
CartesianChartGrid() { MajorLinesVisibility = GridLineVisibility.XY };
DataTable dtAlloys =
new
DataTable(
"DATA"
);
dtAlloys.Columns.Add(
new
DataColumn(
"Name"
,
typeof
(
string
)));
dtAlloys.Columns.Add(
new
DataColumn(
"Value1"
,
typeof
(
double
)));
dtAlloys.Columns.Add(
new
DataColumn(
"Value2"
,
typeof
(
double
)));
dtAlloys.Rows.Add(
new
object
[] {
"Value1"
, 70, 30 });
dtAlloys.Rows.Add(
new
object
[] {
"Value2"
, 15, 85 });
dtAlloys.Rows.Add(
new
object
[] {
"Value3"
, 50, 50 });
BarSeries barSer =
new
BarSeries();
barSer.ShowLabels =
true
;
barSer.CombineMode = ChartSeriesCombineMode.Stack100;
BarSeries barSer2 =
new
BarSeries();
barSer2.ShowLabels =
true
;
barSer2.CombineMode = ChartSeriesCombineMode.Stack100;
foreach
(DataRow drAlloy
in
dtAlloys.Rows)
{
barSer.DataPoints.Add(
new
CategoricalDataPoint() { Category = drAlloy[
"Name"
], Label =
string
.Format(
"{0:N}"
, drAlloy[
"Value1"
]), Value =
double
.Parse(drAlloy[
"Value1"
].ToString()) });
barSer2.DataPoints.Add(
new
CategoricalDataPoint() { Category = drAlloy[
"Name"
], Label =
string
.Format(
"{0:N}"
, drAlloy[
"Value2"
]), Value =
double
.Parse(drAlloy[
"Value2"
].ToString()) });
}
CartesianChartDemo.Series.Clear();
CartesianChartDemo.Series.Add(barSer);
CartesianChartDemo.Series.Add(barSer2);
I am trying to use the MouseDown event to do something like show an alert with bar info or open a new window and pass it data from that bar that I am clicking.
How can I obtain the data of the bar that I am clicking?
It is ok to use that event or should I use another one?
Thanks,
Alberto