The 'Microsoft Chart Control' ActiveX control, or MSChart,
that comes with MS Office has a lot to offer, however does not have
much documentation and requires a lot of CiCode to configure
correctly.
The simplest way to configure and implement an instance of
MSChart is to create a 'Wrapper ActiveX' object in your programming
language of choice, which contains an instance of the MSChart
ActiveX control, configured in the way you will be using it in
SCADA.
Attached is a 'Wrapper' that uses the MSChart control, and is
configured to display one PieChart, with up to 10 segments. The
display is all hard-coded within the 'Wrapper', all that can be
configured from the Citect side is the Title, the names of the
Segments, and the value of each segment. The 'Wrapper' has been
configured such that SCADA tags can be linked to the Segments, so
that when the Tag changes value, the graph is updated
appropriately.
To use:
* Register the attached CiPie.ocx control, ensure you also
have the MSChart control - possibly comes with MS Office
* Paste an instance on a SCADA page, record AN
* Use Cicode similar to that shown below to configure the control,
and associate tag to it.
In this E.g we have a pie chart at AN205 and AN206.
//Configure an 8 segment PieChart
and link to 8 tags FUNCTION ConfigMyPie()
//Set 8
Segments _ObjectSetProperty(ObjectByName("AN205"),"NumberSegments","8");
//Set the
Heading _ObjectSetProperty(ObjectByName("AN205"),"ChartHeading","My
Pie");
//Configure 8
Segments _ObjectSetProperty(ObjectByName("AN205"),"NameSeg1","My Tag 1");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg2","My Tag
2");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg3","My Tag
3");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg4","My Tag
4");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg5","My Tag
5");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg6","My Tag
6");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg7","My Tag
7");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg8","My Tag
8"); ;
//Link the Tags to each Segment. The value will then update
whenever the tags change ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg1", "Tag1"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg2", "Tag2"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg3", "Tag3"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg4", "Tag4"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg5", "Tag5"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg6", "Tag6"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg7", "Tag7"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg8", "Tag8");
;//Update the %
labels on each segment _ObjectCallMethod(ObjectByName("AN205"),"UpdateLbls"); ;END
//Configure a
4 segment PieChart and link to 4
tags FUNCTION
ConfigMyPie()
//Set 4
Segments _ObjectSetProperty(ObjectByName("AN206"),"NumberSegments","4");
//Set the
Heading _ObjectSetProperty(ObjectByName("AN206"),"ChartHeading","My
Pie");
//Configure 8
Segments _ObjectSetProperty(ObjectByName("AN205"),"NameSeg1","My Tag 11");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg2","My Tag
12");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg3","My Tag
13");
_ObjectSetProperty(;_ObjectSetPropertyObjectByName("AN205"),"NameSeg4","My Tag
14");;
//Link the Tags to each Segment. The value will then update
whenever the tags change ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg1", "Tag11"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg2", "Tag12"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg3", "Tag13"); ;ObjectAssociatePropertyWithTag(ObjectByName("AN205"),
"DataSeg4", "Tag14"); ; //Update the %
labels on each segment _ObjectCallMethod(ObjectByName("AN205"),"UpdateLbls"); ;END
; //Configure a 4 segment PieChart and link to 4
tags//Configure a 4 segment PieChart and link to 4 tags;
; //Configure a 4 segment PieChart and link to 4 tags
|