vcStatisticsChart

vcStatisticsChart allows you to plot and graph the data of reported items in a chart.

Properties

Name Type Access Description
AllSources List of List R Gets all sources of reported items, including their components.

A reported item is a vcProperty object associated with a component. For example, a reported item could be a component property or a property of a component behavior.

A vcVector object is used to define the display color of reported item in chart.

Each element in the list is a list that contains these elements: vcProperty property, String expression, vcComponent component, vcVector color, Real thickness

ChartTileType Integer RW Defines the location type of chart, thereby indicating whether the tile is an empty or filled with a chart.

Generally, you would use ChartTileType to parse through several charts in a dashboard to collect data from charts that report items. For example, you could ignore or skip empty tiles.

ChartType Enumeration RW Defines the chart type.

For more information, see Statistics Constants.

DataRows List of List R

Gets the data collected during a simulation from reported items.

Each element in the list is a list that contains these elements: Real simulation_time, Real value1, ... Real valueN

DataType Enumeration RW Defines the data type of chart.

For more information, see Statistics Constants.

FieldCountPerProperty Integer RW Defines the field count of items reported by chart.
LegendVisibility Boolean RW Turns on/off the display of chart legend.
Name String RW Defines the title of chart.
Position List of Object RW

Defines the position chart in tab grid.

The list contains these elements: String name, Integer column, Integer row, Integer column_span, Integer row_span

RecordAccumulatedValues Boolean RW Turns on/off the collection of data reported by chart.
SamplingInterval Real RW Defines how often (in seconds) the chart updates to show recorded data during a simulation.

If -1, the chart uses the sampling interval of its dashboard.

Series List of vcStatisticsSeries R Gets a list of data series used by chart to report items.
TileType Enumeration RW Same as ChartTileType.

For more information, see Statistics Constants.

TitleVisibility Boolean RW Turns on/off the display of chart title.

Methods

Name Return Type Parameters Description
addSeries vcStatisticsSeries None Adds a new data series to chart.
clearData None None Removes all data reported by chart, thereby emptying DataRows.
clearSeries None None Resets all data series in chart, thereby emptying AllSources.
deleteSeries None vcStatisticsSeries data_series Deletes a given data_series from chart.
update None None Refreshes the chart.

Examples

Example. Add, remove and reset data series in chart

from vcScript import *
 
app = getApplication()
dashboard = app.Dashboard
tab = dashboard.SelectedTab
tab.clearLayout()
 
#insert new chart in free tile
for chart in tab.Charts:
  if chart.TileType == VC_TILETYPE_PLACEHOLDER:
    chart = tab.createChart(tab.Charts[0],VC_CHARTTYPE_BAR,True)
 
#empty the chart, create new series, (optional) remove any existing series
if chart != None:
  if chart.Series:
    for i in chart.Series:
      chart.deleteSeries(i)
  x = chart.addSeries()
  y = chart.addSeries()
  
  #instead of deleting series
  #you may want to reset series and clear reported items of chart
  chart.clearSeries()