beautypg.com

Populate the mpr with data – Rockwell Automation 9307 FactoryTalk EnergyMetrix User Manual

Page 219

background image

9

ReportsPlus

219

.SeriesLegendBox = True

End With

...

'as each data series is created, the following configures the
data series legend:

chart1.SeriesLegend =

Configuring a PieChart Object

A PieChart object has only a few configurable properties. The following example creates a
pie chart object and configures its properties.

dim chart2 As PieChart()

...

chart2 = New PieChart()

With chart2

.Title.Text = "Energy Dollars (thousands)"

.Chart3D = False

.CustomFormat ' "$#,##0,"

End With

Configuring a RichTextBox Object

A RichTextBox object has only a few configurable properties, including Top, Left, Height
and Width. Formatting of the text within a rich text box is done using RTF control codes.
Refer to RichTextBox Object.

Populate the MPR with Data

Once a MPR object has been created and configured, follow these steps to add data to the
MPR.

1. Use the Add method of the MPR object to create a data display element such as a Row

in a Grid object.

2. Define the data content of the data display element.

In general, the data content must be defined in the script immediately after the data display
element is created. Refer to the following examples.

Pie Chart Example

Sub Main()

'declarations omitted

...

For Each group in Report.Groups

consumption = group.Total(ValueType.RealEnergyNet) 'calculates
value of consumption variable

pieChart.AddData(group.Name, consumption) 'adds segment
to the pie chart

'gives the segment the group name

'assigns the segment the consumption variable

Next group

...

End Sub