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 the same in the Avalonia viewer.
Build the chart. Create the report and page, then a
StiChart with its area and series, and add it to the page:var 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 prepare the data
page.Components.Add(chart);
report.Dictionary.Synchronize();StiChartwith aStiGanttAreaandStiGanttSeries— the chart, its plotting area and the data series.- Source data is loaded from the app package with
AssetLoader.Open(new Uri("avares://…")). page.Components.Add(chart)+Dictionary.Synchronize()— put the chart on the page and prepare its data.
How it works. The chart object graph you build in code is identical to one designed visually, so it renders the same in the Avalonia viewer.