Home > Software engineering >  VB MSChart multiple curve drawing, array assignment is correct, but the curve has a few don't s
VB MSChart multiple curve drawing, array assignment is correct, but the curve has a few don't s

Time:09-19

I want is that the effect of different times human input, and then MSChart show the curve of the corresponding period, a total of 20 curve,
But found during debugging, show the number of curve and Mydata (20), the size, the size, which is odd, curve number should not be 20?
I feel is behind. ColumnCount=Size has a problem, but found that only. ColumnCount=the Size curve can be displayed, if change. ColumnCount=20 such statements or delete a curve can show a,

 Dim MyData () As Single 
ReDim MyData (Size 1, 20) As Single 'defines the 20 curve
For I=0 To 1
the Size -Sum=0
For j=0 To 19
Sum=Sum + Val (Data_Year (MinYear). Data_Month (MinMonth). Month_People (j) Lab)
MyData (I, j)=Sum 'for each curve assignment
Next j
If MinMonth=11 Then
MinYear=MinYear + 1
MinMonth=0
The Else
MinMonth=MinMonth + 1
End the If
Next I

'the waveform diagram appearance Settings
With MSChart1

. Backdrop. The Fill. Brush. The FillColor. Set 255, 255, 255
SE figure. TitleText="personnel"
"Change the appearance of the graph line

'set the XY
. The Plot. The Axis (VtChAxisIdX). ValueScale. Auto=False
. The Plot. The Axis (VtChAxisIdY). ValueScale. Auto=False
'//set the maximum
'. The Plot. The Axis (VtChAxisIdX). ValueScale. The Maximum=10000 'set a Maximum transverse mark
. The Plot. The Axis (VtChAxisIdY). ValueScale. Maximum=10 'set a Maximum longitudinal Axis annotation
'//set the minimum
. The Plot. The Axis (VtChAxisIdY). ValueScale. Minimum=0
. The Plot. The Axis (VtChAxisIdX). ValueScale. Minimum=0
'//
. The Plot. The Axis (VtChAxisIdX). ValueScale. MajorDivision X=20 'main grid number
. The Plot. The Axis (VtChAxisIdY). ValueScale. MajorDivision Y=10 'main grid number
. The Plot. The Axis (VtChAxisIdX). ValueScale. MinorDivision X=0 'secondary grid number
. The Plot. The Axis (VtChAxisIdY). ValueScale. MinorDivision Y=0 'secondary grid number
. The Plot. The Axis (VtChAxisIdX). AxisGrid. MajorPen. Style=VtPenStyleDotted
. The Plot. The Axis (VtChAxisIdY). AxisGrid. MajorPen. Style=VtPenStyleDotted
MSChart1. Plot. AutoLayout=False
MSChart1. Plot. UniformAxis=False
MSChart1. ChartType=VtChChartType2dLine 'set the graphics to 2 d scatter plot
MSChart1. ChartData data
=https://bbs.csdn.net/topics/MyData '
For I=1 To 20
. The Plot. SeriesCollection (I). LegendText=Data_Year (0). Data_Month (0). Month_People (I - 1). The Name
Next I
For I=1 To 20
. The Plot. SeriesCollection (I). Pen. Width=10
. The Plot. SeriesCollection (I). Pen. Style=VtPenStyleSolid
Next I

For I=1 To 20
. The Plot. SeriesCollection (I). The DataPoints (1) _
DataPointLabel. LocationType=VtChLabelLocationTypeBelowPoint
Next I

The ColumnCount=Size 'delete or modify all cannot show curve
For k=1 To Size
The Row=k
RowLabel=Data_Year (kcountyear). Date_year & amp; "/" & amp; Data_Year (kcountyear). Data_Month (kcountmonth). Date_month
If kcountmonth=11 Then
Kcountyear=kcountyear + 1
Kcountmonth=0
The Else
Kcountmonth=kcountmonth + 1
End the If
Next k
End With

CodePudding user response:

Top,,, don't sink, such as online

CodePudding user response:

Double-click on the control, into the property page dialog box controls, set up relevant properties,

CodePudding user response:

Hello, today I tried it on changes in the properties page, but found that the property page can only to modify drawing style, but it is the inside of the sequence and ChartData draw the curve of feeling has nothing to do, to how to solve this,

CodePudding user response:

All commented On the Error Resume Next statement, in VB6 IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,

CodePudding user response:

Actually may be MSChart bug, actually it drummed up by oneself also is not difficult to draw curve also can according to their requirements

CodePudding user response:

You understand error, Mydata (20), the size, number, size is curve in 20 is the number of points on the curve of each,
ColumnCount, RowCount suggest explicitly specified (try before/after the ChartData assignment).
  • Related