USE OF CHART CONTROL IN PROJECT WORKBENCH . . .
2023-01-05-092316
All --
I have an IMAGE-PRO PLUS V7 APP that I am upgrading to an IMAGE-PRO V10 APP.
The APP for V7 was written with VISUAL BASIC from VISUAL STUDIO.
The APP for V10 is being written with the PROJECT WORKBENCH.
In the APP for V7, there is a CHART that appears as shown here.
This CHART has a PRIMARY Y AXIS and a SECONDARY Y AXIS that have different MIN / MAX / RANGE and X AXIS LABELS that are ROTATED.
Something similar from EXCEL is shown here
I would like to generate the same type of CHART using V10 but I am not able to get the VALUES to appear for the PRIMARY Y AXIS or the SECONDARY Y AXIS and I am not able to ROTATE the VALUES for the X AXIS.
I have poked at the configuration of the CHART CONTROL in the PROJECT WORKBENCH DESIGN VIEW and the CODE in the CODE VIEW and the best that I can get is similar to
When my DATA is set up as
chart1.Series("Series1").Points.AddXY("AAA",4) chart1.Series("Series1").Points.AddXY("BBB",5) chart1.Series("Series1").Points.AddXY("CCC",6) chart1.Series("Series2").Points.AddXY("AAA",40) chart1.Series("Series2").Points.AddXY("BBB",50) chart1.Series("Series2").Points.AddXY("CCC",60)
I have created and attached an IPX FILE named
CHART QUESTION PROJECT.ipx
that I hope will be helpful in directing me to the solution.
I would also appreciate it if you could direct me to what is wrong with the DATA BIND XY statement that is in the IPX FILE and shown here but I know how to work around that.
Dim Prog_HistDataX () As Single
Dim Prog_HistDataY () As Single
'Dimension the ARRAYS to match the HISTOGRAM
ReDim Preserve Prog_HistDataX (3)
Prog_HistDataX(0) = 1
Prog_HistDataX(1) = 2
Prog_HistDataX(2) = 3
ReDim Preserve Prog_HistDataY (3)
Prog_HistDataY(0) = 4
Prog_HistDataY(1) = 5
Prog_HistDataY(2) = 6
'Bind the X and Y DATA ARRAYS to the CHART
' chart1.Series("Series1").Points.DataBindXY(Prog_HistDataX,Prog_HistDataY)
Thanks.
Thanks.
-- Matt
0
Answers
I see that you use System.Windows.Forms.DataVisualization.Charting.Chart class for the chart.
This is a .NET class from microsoft. You can find info on the web, just search for "System.Windows.Forms.DataVisualization.Charting.Chart". For example:
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datavisualization.charting.chart?view=netframework-4.8.1
or
https://snipplr.com/view/25227/datavisualizationchartingchart-simple-example
Regards,
Yuri
I never worked with this chart control personally, but I found an example on web that demonstrates using 2 axes:
https://skanky.dev/csharp/c-sharp/charts/examples/creating-a-chart-with-2-y-axis
I converted the example from C# to VB.NET using https://converter.telerik.com/
and attached the IPX with the example, the result looks like this:
Yuri
-- Matt
I'm glad that you've found a solution!
The problem with DataBindXY is that IP10's macro language in interpreted mode cannot handle that conversion, so a workaround would be to switch the project to "Compiled" mode (where DataBindXY is handled properly) or use AddXY function instead, as you did.
Yuri