views:

106

answers:

0

I am currently developing an application that uses chart control to create a histogram. The histogram displays data correctly however I would like to center the data. Right now the Min and Max are automatically set. I would like the graph to always force its to be displayed symmetrically.

Here is an example of what I'm trying to accomplish.

Basically I would like it to look like a normal distribution graph. Does anyone know how I can do the the following:

  1. Get the graph to be displayed symmetrically?
  2. Always show a zero line.

Here is the aspx markup.

<asp:Chart ID="ChartHistogram" runat="server" Height="200" Width="300">
   <Series>
      <asp:Series Name="SeriesDataHistogram" ChartType="RangeColumn" Color="#4d5b6e" BorderColor="#ffffff" BorderDashStyle="NotSet">
      </asp:Series> 
   </Series>
   <ChartAreas>
      <asp:ChartArea Name="ChartAreaMain" BorderColor="#CCCCCC">
         <AxisX TitleFont="Arial, 7pt" LabelAutoFitMaxFontSize="7">
            <MajorGrid LineColor="#FFFFFF" Interval="5" />
            <LabelStyle Format="P1" />
         </AxisX>
         <AxisY Title="Frequency" TitleFont="Arial, 7pt" LabelAutoFitMaxFontSize="7">
            <MajorGrid LineColor="#FFFFFF" />
         </AxisY>
       </asp:ChartArea>
    </ChartAreas>
</asp:Chart>

Here is the code behind

private void DrawHistogram(List<ReturnDataObject> list)
{ 
   foreach (ReturnDataObject r in list)  

   this.ChartHistogram.Series["SeriesDataHistogram"].Points.AddY(r.ReturnAmount); 

   // HistogramChartHelper is a helper class found in the samples Utilities folder.  

   HistogramChartHelper histogramHelper = new HistogramChartHelper(); 

   // Show the percent frequency on the right Y axis. 

   histogramHelper.ShowPercentOnSecondaryYAxis = false; 

   // Create histogram series
   histogramHelper.CreateHistogram(ChartHistogram, "SeriesDataHistogram", "Histogram"); 
}

Thanks for any help.