The Chart has numerous properties available for configuration in the Properties pane. The following topic describes a basic workflow for configuring this control. The specific appearance and functionality of the object you create depends on your needs and implementation of the control's properties, each of which is described below.
Use the Settings pane to apply common settings (sizing, grouping, alignment, etc.) to this object (and others) on your screen.
The Style property defines the style sheet applied to an object on a screen. A style sheet consists of a predetermined list of properties and property values configured for a particular control type.
Styles are created in two ways:
Tip: You can also change a control's Style on the Controls view of the Screen pane.
The Include in script check box indicates that the control will appear in the objects collection of the screen (if scripting is enabled). To optimize performance, best practice dictates that you only include the controls you need to manipulate via script. Other controls should be excluded. When you add an event to a control, it will be automatically added to script and the Include in script property (and the In Script check box on the Controls view) will be set to True.
Tip: You can also change the Include in Script setting on the Controls view of the Screen pane.
The Height property specifies the height of the control (or screen).
Tip: You can also change the height of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The Horizontal resize mode property specifies whether and how the control dynamically moves or resizes horizontally when the screen is resized in run mode. Options include:
The default value is None.
The Layer property specifies the layer for this control. Layers are used to show, hide, and edit multiple controls on one layer without affecting controls on another layer.
Tip: You can also edit a control's Layer on the Controls view of the Screen pane.
The Vertical resize mode property specifies whether and how the control dynamically moves or resizes vertically when the screen is resized in run mode. Options include:
The default value is None.
The Width property specifies the width of the control (or screen).
Tip: You can also change the width of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The X property specifies the location of the control along the horizontal axis. Use the up, down, left, and right arrow keys to nudge a control by 1 pixel. Arrow moves a control by 1 pixel. Ctrl+Arrow moves a control by 10 pixels. Ctrl+Shift+Arrow moves a control by 100 pixels.
Tip: You can also change the location of the control using the Settings pane; click on the
(Settings) to the right of the control in design mode.
The Y property specifies the location of the control along the vertical axis. Use the up, down, left, and right arrow keys to nudge a control by 1 pixel. Arrow moves a control by 1 pixel. Ctrl+Arrow moves a control by 10 pixels. Ctrl+Shift+Arrow moves a control by 100 pixels.
Tip: You can also change the location of the control using the Settings pane; click on the
(Settings) to the right of the control in design mode.
The Z index property is used to determine the order in which controls are layered on top of each other. Controls with higher values will draw on top of those with lower values. The newest control added to a screen will always have the highest value and will be the top layer. Two or more controls can be on the same index (layer).
Tip: You can also change the Z index of a control using the Settings pane (click on the
(Settings) to the right of the control in design mode) or on the Controls view of the Screen pane.
The Chart drop mode property specifies how the chart should handle the facility from a dropped point. Two options are available:
The default value is Use dropped facility.
The Hover mode property specifies the mode when hovering over a series in the chart. Two options are available:
The default value is None.
A series is a continuum of y-axis/x-axis points plotted on a graph that represent a CygNet point's behavior over time. You can add multiple series for the same CygNet point. For instance, you might want one series to represent raw data and another series to represent rollup data. You can also override the source of the data at the series level.
The Series configuration box contains all the properties required to configure a series on your chart. The number of defined series is listed on the property label. Although some properties of a series are inherited from the screen or from another object on the current screen, you can define properties specific to a certain series, in some cases overriding the inherited properties.
Click
to expand each property group. Click
to collapse each property group.
The Series type property specifies the style to use for the chart series. Click
to select an option from the drop-down menu. Options include:
Click here to see an example of each type of series.
Select the Override chart's facility check box to specify a different facility for this chart series. Once checked a facility field is revealed where you can override the facility configured for the chart. The chart's facility is specified in the CygNet Connection property group.
If Override chart's facility is selected the Resolve to a relative facility option is removed.
By default, a rollup derives its values from raw data stored in the Value History Service (VHS). The Rollup type drop-down menu enables you to rollup data for the selected point. Using the Rollup type option might be preferable to using the data thinning option because rollup calculations performed by the VHS can provide improved performance and reduced network traffic relative to data thinning. Rollup type options are as follows:
CygNet Help: For Rollup Type definitions and information about how history values are used in rollups, see the History Rollups topic in the CygNet Help:
The Rollup unit property options define the time units by which a specified Rollup type takes place. The Rollup Unit options are as follows:
For instance, if you select Minutes, rollups occur on a minute basis. The interval is further defined by the Rollup Period setting, which defines how many (in this case) minutes long a rollup period is.
The Data source property specifies the source of the data used in a selected series. The options are as follows:
The following example guides you though creating a scripted chart series, adding delegates to show random data and auto update the series, and some important notes.
GetCustomSeriesData method below the //add custom methods here comment in the public class ScreenClass class. See the following example. This example also includes a GetCustomSeriesAutoUpdateData method to handle an auto updating series. Also see the comments showing the ability to handle multiple scripted series.private bool GetCustomSeriesData(Series series) { var date = Objects.Chart1.DateStart; Random rand = new Random();
//if there are multiple scripted series, use the series name to distinguish between them if(series.Name == "Custom 1") { //simple loop to populate series with random value while (date <= Objects.Chart1.DateEnd) { //create random number double value = rand.NextDouble() * 100;
//add to series //if the series is a bar type, the color needs to be supplied in AddData series.AddData(date, value);
//increment the date date += TimeSpan.FromSeconds(60); } }
if(series.Name == "Custom 2") { //simple loop to populate series with random value while (date <= Objects.Chart1.DateEnd) { //create random number double value = rand.NextDouble() + 1000;
//add to series //if the series is a bar type, the color needs to be supplied in AddData series.AddData(date, value);
//increment the date date += TimeSpan.FromSeconds(60); } } return true; }
public bool GetCustomSeriesAutoUpdateData(Series series, DateTime start, DateTime end) { //start - the datetime at the beginning of the update interval //end - the datetime at the end of the update interval
//insert custom series auto update code here
return true; } |
Canvas.Shared.Models namespace. So, at the top of the script you need to add a statement to indicate this:using Canvas.Shared.Models; |
private void Screen_Initialize(object sender, EventArgs args) {
//hook up a GetCustomSeriesData delegate on the chart for the scripted series Objects.Chart1.GetCustomSeriesData = GetCustomSeriesData;
//hook up a GetCustomSeriesAutoUpdateData delegate on the chart for the scripted series Objects.Chart1.GetCustomSeriesAutoUpdateData = GetCustomSeriesAutoUpdateData;
//after the delegates are connected, the chart data needs to be refreshed Objects.Chart1.RefreshChart(true);
} |
Here is an example of adding a point to the chart.
AddData(DateTime.Now, 150) |
AddData(DateTime.Now, 150, "Blue") |
The Date range configuration property is used to configure the range of dates to be trended in the chart or sparkline, whether to enable live data updates, the live update rate, the starting time for a trend, whether to use relative or absolute dates, and the actual date range. Click
to open the Configure Time Range dialog box, where you can configure these properties. You can change the date and time range settings for any chart in run mode via an icon on the chart toolbar.
The source of your CygNet data can be explicitly configured for the control or it can be inherited from the screen or another control.
The Selection mode property is used to determine how the control will receive CygNet information from other controls. Two options are available; click the desired radio button:
Some controls on the same screen allow for the sending of facility tag information from one control to another.
Each axis uses its own property set. The x-axis always displays increments of time units. The time units and increments displayed on the x-axis are user defined. The y-axis of a series typically displays increments of data according to the data's relevant unit type. The unit type derives from the associated data type's point record in the Point Service (PNT).
The Zooming and Panning properties allow you to enable zooming and panning behavior in run mode. See To drag, pan and zoom in run mode for more information about using this behavior in run mode.
The Drag mode property determines the drag action for the chart in run mode. Setting it to Pan will start panning, instead of zooming when you drag the mouse over the plot area. To forbid any drag actions you can set the Drag mode to None. Options include:
The default value is None.
The Pan mode property allows users to pan in the chart plot area when there is a dense area of data points that cannot be seen clearly at the normal chart scale. With Pan enabled you can reduce the area you want to examine using the scroll bars, and then drag the chart within the pan region horizontally, vertically, or in both directions. Options include:
The default value is None.
The Zoom mode property allows users to zoom in the chart plot area when there is a dense area of data points that cannot be seen clearly at the normal chart scale. With Zoom enabled you start dragging on the plot area, a zoom rectangle will be created and when the mouse is released the visible area will fit into the rectangle. Options include:
The default value is None.
The Tag Chooser displays a hierarchical tree of CygNet facilities and points, allowing the creation and implementation of templated screens in Canvas. It can be used as the primary navigational control on your screens to drive other controls by passing in facilities and point values. The tag chooser supports both facility and point resolution. Point resolution is optional at the facility level and can be turned off or on simply by selecting the Show points check box at design time. Facilities are designated with a dark yellow diamond (
) and points are designated with a blue circle (
) in the tag chooser hierarchy.
The tag chooser offers two hierarchy types: by Facility service attributes, or by Group service nodes:
You can select any point or facility in the tag chooser pane and drag and drop it onto your control in both design and run mode.
until you reach the target area, where the symbol will change to a blue plus sign
, indicating that the item can be dropped onto the control.