how to configure the chart by program ?

mohanarajmohanaraj 600001
edited February 2010 in FastReport .NET
Dear all,

How can i able to configure the chart type report ?

i want to display the graphical report so that i want to provide option to user, to generate the report with their configuration.

like

1, Option to choose different chart type like pie chart, bar chart etc..

2. Option to choose show/don't show legend.

3. Option to choose the color of the chart areas.

How can i do this by program ? not in design itself


please give an example.

Comments

  • edited 7:03PM
    mohanaraj wrote: »
    Dear all,

    How can i able to configure the chart type report ?

    i want to display the graphical report so that i want to provide option to user, to generate the report with their configuration.

    like

    1, Option to choose different chart type like pie chart, bar chart etc..

    2. Option to choose show/don't show legend.

    3. Option to choose the color of the chart areas.

    How can i do this by program ?

    please give an example.
    what u mean is configure it all at the dialogue form ?
  • mohanarajmohanaraj 600001
    edited February 2010
    Hello,

    I want to do this by program.

    Eg In my page one check box is displayed with text LEGEND if the user checked that checkbox then only Legend is shown in the report, and also they want to choose the color for the chart (area in that chart.)
  • edited 7:03PM
    Hello,

    Sorry, I have no complex example right now.

    You can add or remove chart series by the MSChartObject.AddSeries, DeleteSeries methods. You need to reference the MS Chart dll - System.Windows.Forms.DataVisualization.dll. Once you have added the series, you need to configure it.
          Report report = new Report();
    
          ReportPage page = new ReportPage();
          report.Pages.Add(page);
          page.CreateUniqueName();
    
          page.ReportTitle = new ReportTitleBand();
          page.ReportTitle.Height = Units.Centimeters * 10;
          page.ReportTitle.CreateUniqueName();
    
          // create chart object
          MSChartObject chart = new MSChartObject();
          chart.Parent = page.ReportTitle;
          chart.CreateUniqueName();
          chart.Bounds = new RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 8);
    
          // create column-type series
          MSChartSeries barSeries = chart.AddSeries(System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
          barSeries.AddValue("A", 1);
          barSeries.AddValue("B", 2);
          barSeries.AddValue("C", 3);
          barSeries.AddValue("D", 4);
    
  • edited 7:03PM
    AlexTZ wrote: »
    Hello,

    Sorry, I have no complex example right now.

    You can add or remove chart series by the MSChartObject.AddSeries, DeleteSeries methods. You need to reference the MS Chart dll - System.Windows.Forms.DataVisualization.dll. Once you have added the series, you need to configure it.
          Report report = new Report();
    
          ReportPage page = new ReportPage();
          report.Pages.Add(page);
          page.CreateUniqueName();
    
          page.ReportTitle = new ReportTitleBand();
          page.ReportTitle.Height = Units.Centimeters * 10;
          page.ReportTitle.CreateUniqueName();
    
          // create chart object
          MSChartObject chart = new MSChartObject();
          chart.Parent = page.ReportTitle;
          chart.CreateUniqueName();
          chart.Bounds = new RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 8);
    
          // create column-type series
          MSChartSeries barSeries = chart.AddSeries(System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column);
          barSeries.AddValue("A", 1);
          barSeries.AddValue("B", 2);
          barSeries.AddValue("C", 3);
          barSeries.AddValue("D", 4);
    
    when i add DLL to reference, they have a warning!
    why?
    and code not working!
    have eror on stem.Windows.Forms.DataVisualization

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.