You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Next »

By default, graphs are created in a very basic form: the series have no title, a default color and thickness (maybe not the ones you prefer) is used for all of them, the axes have no title either, no legend is shown, etc. 

 

We will now modify the layout and style of the chart to make it easier to read and more appealing (for example to use it in a report). First of all, add a title to the series corresponding to the results of the model with the initial settings. In all the following code, feel free to use the styling options (e.g. colors) you like the most.

Add title to an existing series
lineResults.Title = "Model results"

You can then customize the point series corresponding to the measured data (by default, small white dots)

Customize point series
dataSeries.Title = "Measurements"
dataSeries.Color = Color.Red
dataSeries.Size = 4
dataSeries.LineVisible = True
dataSeries.LineColor = Color.Black

Finally, add a title to the entire chart as a whole. Also, add their respective titles to the axes, and show the legend for the plot, which explains what the different series represent.

Customize chart as a whole
chart.Title = "Comparison measurements vs results"
chart.TitleVisible = True
chart.BottomAxis.Title = "Time"
chart.LeftAxis.Title = "Waterlevel [m]"
chart.LeftAxis.Automatic = False
chart.LeftAxis.Maximum = 2
chart.LeftAxis.Minimum = 0
chart.Legend.Visible = True
chart.Legend.Alignment = LegendAlignment.Bottom

The figure will now be much easier to understand.

Using the autocomplete function of the scripting editor, change some additional elements of the chart (use auto-complete to check all possible options) until you find that the plot looks the way you want.

 

Enclose all the code in this section in a separate region to help keep your code tidy and easier to understand.

 

  • No labels