Main Menu
Knowledge Base
Product Registration
Log an Incident
Request a Feature
Search Incidents/Bug Reports

Search KB

Please note: In an effort to better serve you, we are in the process of restructuring DevCenter. In the process, we have moved many items that you may be used to finding in DevCenter over to the Main Site. If you are having trouble locating something, please try looking at the following places:

Knowledge Base Article: KB09975

HOWTO:Drill down in WinChart [Part 5]

The information in this article applies to:
UltraWinChart (v6.1.20061)
  Article Created: 

Last Updated:

Article Type
How To
Page Options
Average Rating:
2 out of 10

Rate this page
Print this page
E-mail this page
Add to Favorites



Step-By-Step Example

Code: Getting the Data


    '/// This method simply gets the data and returns it in a
    '/// data table

    Private Function GetChartData(ByVal theCommand As SqlCommand) As DataTable
        Dim d As SqlDataAdapter = New SqlDataAdapter(theCommand)
        Dim t As DataTable = New DataTable("ChartData")
        Return t
    End Function


        /// This method simply gets the data and returns it in a
        /// data table

        private DataTable GetChartData(SqlCommand theCommand)
            SqlDataAdapter d = new SqlDataAdapter(theCommand);
            DataTable t = new DataTable("ChartData");
            return t;

For this particular sample, the code and logic for data access is within the user interface. In a real-world enterprise application, this will be handled by the Data Access Layer and / or business objects that reside in the Business Logic Layer. For simplicity sake, this sample includes everything within the user interface. As you can see here, this method accepts a SqlCommand that was built in the BuildChart method and it returns a DataTable that contains the schema and data for a particular drill level.

Code: Initiating the Drill Down through the UI


    '/// Upon clicking on a Data Item, we drill down one level and
    '/// rebuild the chart

    Private Sub ultraChart1_ChartDataClicked( _
            ByVal sender As Object, _
            ByVal e As Infragistics.UltraChart.Shared.Events.ChartDataEventArgs) _
            Handles ultraChart1.ChartDataClicked
        If (_currDrill = MAX_DRILL) Then Return
    End Sub


        /// Upon clicking on a Data Item, we drill down one level and
        /// rebuild the chart

        private void ultraChart1_ChartDataClicked(
            object sender,
            Infragistics.UltraChart.Shared.Events.ChartDataEventArgs e)
            if (_currDrill == MAX_DRILL)return;
            this.BuildChart( e.RowLabel );

The end user initiates the drill down by simply clicking on any Data element within the Chart. When the form first loads, the user clicks on a bar, which represents one customer. The Chart then drills to the next level and that represents the single Customer’s Orders. The User then clicks on one Order represented by another Chart Bar. This causes us to drill down to the next level which is now a Chart that is populated with the particular Order’s Line Items and thus ends the drilling because this is the maximum drill level.

The Chart click interaction is handled by the “ChartDataClicked” event. In this event, we have enough information to allow us to drill to the next level. The event arguments in this event provide much useful information. We are only using the Row Label in this case. The Row Label represents the one string value in a particular row in which the resulting data is grouped by. For example, if we submit a SQL query that selects a person’s First Name and then a count of sales and we group by the First Name, the resulting data would contain a list of First Names along with a numeric that represents the sales for each person. The actual First Name value of each row would be considered the “Row Label” in chart terms. We use this Row Label to build another query such as “get me the orders that belong to customer ALFKI”


Related Articles

HOWTO: Drill down in WinChart [Part 4] (KB09974)

HOWTO: Drill down in WinChart [Part 6] (KB09978)

HOWTO: Drill down in WinChart [Part 3] (KB09973)

HOWTO: Drill down in WinChart [Part 2] (KB09972)

HOWTO: Drill down in WinChart [Part 1] (KB09971)

 WinChart Drilldown Samples in C# and VB.NET

How would you rate the quality of this content?
Poor -----------------------------------------> Outstanding

Tell us why you rated the content this way. (optional)