Ticket Q499270
Visible to All Users

Creating a summary chart from a table of data

created 12 years ago

Hi,

I'm looking at using the Chart Control for the first time and have a basic question before I begin. I have looked at the "Getting started" documentation and online videos but am a little unclear as to how to be the most efficient at getting some data into a chart.

My application already loads e.g. a main table at runtime with all "current clients". Each client is assigned to an employee and I'd like e.g. a pie chart to show the breakdown across employees: Employee A has 25 clients, Employee B has 36 clients etc etc.

My question is whether the Chart Control can look at this table and can summarise to get these totals within its built in functionality or do I have to provide a separate table with the summarised data directly from SQL Server. Or would you recommend I use a temporary table created at runtime? My dataset already has the appropriate relationships so I have functions like Row.GetTableBRows.Count at my disposal.

I have already looked through an online "How-to" but the example shows a product and the price straight from a table which isn't exactly the same format data as I have.

Many thanks.

Miles Young

Answers approved by DevExpress Support

created 12 years ago (modified 12 years ago)

I believe that you can use COUNT summary functions to accomplish this task. Alternatively, you can use your approach with a separate table with the summarized data directly from SQL Server.

    Show previous comments (3)
    DevExpress Support Team 12 years ago

      Would you please provide us with an image illustrating the requested Chart layout and a part of your data source values?

        Hi,
        Yes I have done a quick chart in Excel and attached a screenshot. The chart at the top of the image is what I have currently achieved using my Dataset and your Chart control (using the COUNT() summary function).
        The chart at the bottom half of the image is what I want to achieve. The employees are the same and so are the totals but the bars are stacked (two values) based upon a single field (never null) which is a true or false field.
        Like I say, I'm ideally trying to avoid adding new tables to a dataset so assumed that I might have to create a class/temporary table and iterate through my rows to make this data compatible but I was hoping that perhaps the Chart control would allow a sort of "Count Group" function as a second argument to get sub-counts, as it were.
        I hope that explains what I mean.
        Thank you
        Miles

        DevExpress Support Team 12 years ago

          I suggest that you use the approach described in the "Lesson 4 - Use the Series Template for Auto-Created Series" topic.
          Attached is a small sample project that demonstrates how to accomplish this.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.