I am dyanmically creating a chart with the following code. The chart is being created and rendered at run-time so there is no static object on any aspx page or form. I would now like to add a drill down to the bars but can't figure out how to create it dynamically considering all the examples show use of the object's click event. What options do I have. here is the current charting code:
UltraChart ultraChart1 = new UltraChart();
ultraChart1.ID = "UltraChart1";
mydata.Columns.Add("OnPeak", typeof(double));
mydata.Rows.Add(new object[ {"Sat 3/1/2008",34,12});
mydata.Rows.Add(new object[ { "Sat 3/3/2008", 26, 9 });
ultraChart1.Width = 650;
ultraChart1.Height = 400;
ultraChart1.Border.CornerRadius = 10;
ultraChart1.ColorModel.ModelStyle = ColorModels.CustomLinear;
ultraChart1.DataSource = mydata;
ultraChart1.Data.DataBind();
ultraChart1.RenderControl(htmlWriter);
return stringWriter.ToString();
can you please share a example with drill down client side event?
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/Chart_WebChart_Set_Up_Drilldown_Charts.html
internal class MyDrillDown : IDrillDown
{
private UltraChart myChart;
private string chartName;
public MyDrillDown(UltraChart chart, string chartName)
myChart = chart;
this.chartName = chartName;
}
void Infragistics.UltraChart.Resources.IDrillDown.Drill(int row, int column,
Infragistics.UltraChart.Shared.Styles.ChartType chartType,
object dataSource)
// Initialize child chart
myChart.ChartType = chartType;
myChart.Drill.Enabled = false;
switch (chartName)
case"your Chart Name Here":
//build you datasource
break;
default:
myChart.Data.DataSource = dataSource;
myChart.Data.IncludeColumn(0, false);
myChart.Data.IncludeColumn(1, false);
myChart.Data.DataBind();
since the IDrillDown interface demands we have a datasource just pass a null when you call it because it will be handled in the internal class above's switch statement.
private void Chart_ChartDataClicked(object sender, Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)
Chart.Drill.DrillElements[0].DrillDown.Drill(e.DataRow, e.DataColumn, ChartType.LineChart, null);
if you're unable to add a server-side event handler, you can always handle the client-side click event. the simplest drill-down scenario using client-side code would probably be to change the url using window.open or window.location.href, appending the current row and column numbers into a querystring.