For the DrillElement to work, the code requires a class with IDrillDown. IDrillDown contains only one method Drill , which you will use later.
But first, implement the constructor. The best practice here is to pass in a reference to your WebChart, as was done in the previous step.
Note
|
Note
You can pass in other information through the constructor, such as the title of your WebChart. In this example, only the chart reference is passed.
|
Then the "Drill" method should be written. Note the parameters that are passed in; this is the information you will have access to when you call this method during drilldown. This method is very flexible; in this sample, the only parameters that are needed are "chartType" and "dataSource". Alternatively, you could fetch your data based on the integer values of "row" and "column" (from the parent table).
In the "Drill" method, you must:
Conditional logic can also be used here, such as determining the depth of the drilling.
Note
|
Note
The Drill.Depth property is not implemented in WebChart, so you must use other means to determine this (you can pass your own depth value into the constructor, or through one of the arguments of Drill()).
|
Friend Class MyDrillDown
Implements IDrillDown
Private myChart As UltraChart
Public Sub New(ByVal chart As UltraChart)
myChart = chart
End Sub
Public Sub Drill(ByVal row As Integer, ByVal column As Integer, _
ByVal chartType As _
Infragistics.UltraChart.Shared.Styles.ChartType, _
ByVal dataSource As Object) Implements _
Infragistics.UltraChart.Resources.IDrillDown.Drill
' Initialize child chart
myChart.ChartType = chartType
myChart.Drill.Enabled = False
myChart.Data.DataSource = dataSource
myChart.Data.IncludeColumn(0, False)
myChart.Data.IncludeColumn(1, False)
myChart.Data.DataBind()
End Sub
End Class
internal class MyDrillDown : IDrillDown
{
private UltraChart myChart;
public MyDrillDown(UltraChart chart)
{
myChart = chart;
}
#region IDrillDown Members
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;
myChart.Data.DataSource = dataSource;
myChart.Data.IncludeColumn(0, false);
myChart.Data.IncludeColumn(1, false);
myChart.Data.DataBind();
}
#endregion
}