Creating Chart at Runtime
Our sample projects and report templates can help you learn the basics of working with our products.A chart can be built entirely in code and placed on a report page at run time — no template required.
Build the chart. Create the report and page, then a
How it works. The chart object graph you build in code is identical to one designed visually, so it renders, prints and exports the same way.
Build the chart. Create the report and page, then a
StiChart with its area and series, and add it to the page:report = new StiReport();
// Create a page and add it to the report
var page = new StiPage { /* margins, size */ };
report.Pages.Clear();
report.Pages.Add(page);
// Build the chart, its Gantt area and a series
var chart = new StiChart { EditorType = StiChartEditorType.Simple };
chart.Area = new StiGanttArea { /* axes & grid styling */ };
chart.Series.Add(new StiGanttSeries { /* values & titles */ });
// Place the chart on the page and render
page.Components.Add(chart);
report.Dictionary.Synchronize();
report.Show();StiChartwith aStiGanttAreaandStiGanttSeries— the chart, its plotting area and the data series.chart.Area/chart.Series.Add()— attach the area and series to the chart.page.Components.Add(chart)+Dictionary.Synchronize()— put the chart on the page and prepare the data beforeShow().
How it works. The chart object graph you build in code is identical to one designed visually, so it renders, prints and exports the same way.