Count scale and percentage scale RRS feed

  • Question

  • Well, I have a query like this whose results need to be plotted in teh chart

    Select AuthorName, Count(AuthorName) from books Group by AuthorName

    The result set´would be

    AuthorName     Count
    A                     55
    B                     81
    C                     24
    D                     45
    E                      12

    and I databind as

    Chart1.Series[0].Points.DataBindXY(myView, authorname, myView, count


    And the frequency chart comes out great. I need to provide an option to the user to choose the Y - axis scale  between frquency and the percentage. When frequency is selected the count will be plotted. When the percentage is selected, the Y-axis should have percentage scale. The question is that Is it possible to make the chart to plot the percentage value by supplying only the count OR should I bring in the percentage returned by the query and databind the same.

    Or in other words like sepcifying

    Chart1.Series[0].Label =


    Is it also bossible to specify the Yvalue = "#percent" or something similar


    Monday, April 26, 2010 9:53 AM


  • I don't think there is a built-in way for this.

    The easiest way would be to change the chart type to pie, when you want to show the percentage-view.

    For a column chart you would have to calculate each percentage in the code from the data or get the percentage-value straight from the query like you said. Also, you'll have to set the ChartArea.AxisY.Minimum & Maximum to 0 and 100.

    Monday, April 26, 2010 1:09 PM