First, let's define what we should verify for a displayed chart. I usually check the following:
- Chart Labels
- Chart Legend
- The displayed charts amount
- Chart Curve Coordinates
Now let's look more closely at Nevron charts through the Object Browser.
To do that run the application to be tested that's uses a Nevron Chart control. Navigate to a window with the ChartView control. In TestComplete's Object Browser, locate the icon representing your tested application and open it, then investigate
the sub nodes and locate the Chart View control. Select the Chart View control in the TestComplete Object Browser. As you can see,
the Chart View control has compound 'Labels', 'Charts' and 'Legends' properties. These
are the properties that I use the most.
Working with the 'Labels' Property
If you double click on the 'Labels' property then the NLabelsCollection object with its properties will be displayed. NLabelsCollection has
the 'Count' and 'Item' properties. The 'Count' property contains a number of existing charts labels.
The 'Item' property allows you to get access to the NLabel object by using the get_Item(index) method.
In turn, the NLabel object allows you to get text from the displayed label using
the 'Text' property.
Now that you know how to get access to the labels, we can take a look at the first simple function that allows us to get
an array of labels for the displayed charts.
As you can see, this function returns all existing labels' values. We can use this array to define
the index of the demanded chart and compare two string values. Let's look at the following function:
Working with the 'Charts' and 'Series' Properties
Now, let's look at the 'Charts' property of the Chart View control. Double click on the 'Charts' property -
the NChartCollection object will expand. NChartCollection has the 'Count' and 'Item' properties.
By using the 'Item' property we get access to the NChart object that contains
the compound property, called 'Series'. This property allows us to get access to the NSeriesCollection that
contains the 'Count' and 'Item' properties. So, let's look at the next function that allows us to get
a series number for the chart with a specified index:
Given the example above, we can retrieve all of the chart's labels, we can get
the chart's index using it's label, and we also know how to receive the quantity
Each item of the 'Series' property is contained in the NLineSeries object. By
using the 'Values' property of the NLineSeries object we get access to the NDataSeries object that has
the 'Count' and 'Item' properties. Each Item has the 'm_value' property that stores
the x-coordinate for each dot of the displayed curve. So we can get the number of dots that form
a curve and then get all coordinates. The function below shows how to do this:
Working with the 'Legends' Property
Let's now consider how to work with the 'Legends' property. We work with it
in a similar way that we work with other compound properties of the chart view control. Each item of the 'Legends' property is
contained in the NLegendCollection object. Each item of the NLegendCollection is
contained in the NLegend object that also has the compound 'Data' property. When
the 'Data' property is opened, we get access to the NLegendData object that has
the 'Items' property. Each item of the NLegendData object is
contained in the NLegendDataCollection object. The 'Count' and 'Item' properties are stored in this object.
By using a combination of 'Text' and 'OleValue' properties for each item of the NLegendDataCollection, we can get all
of the values for the existing chart legend. The function below has been created using this structure:
I hope this helps you understand how to work with charts in Nevron .NET