|
make a graph with a matrice |
Posted by Boboss on Jul-18-2012 01:33 |
|
Hello
Sorry to my english
I have a file *.csv with the date, the time and some temperatures
15/07/2012;00:00;21.2;19.3;21.1;9.9;-24.4;21.4;21.3;21
15/07/2012;00:05;21.1;19.3;21.1;9.9;-24.4;21.4;21.3;21
15/07/2012;00:10;21.1;19.2;21;9.9;-24.4;21.4;21.2;21.1
15/07/2012;00:15;21.1;19.2;21;9.9;-24.4;21.4;21.2;21.1
15/07/2012;00:20;21.1;19.2;21;9.9;-24.4;21.4;21.2;21.1
15/07/2012;00:25;21.1;19.2;21;9.9;-24.4;21.4;21.2;21.1
15/07/2012;00:30;21.1;19.2;21;9.9;-24.4;21.4;21.2;21.1
15/07/2012;00:35;21.1;19.2;21;9.9;-24.4;21.4;21.1;21.1
I create a matrix
temp(0,0)=0 temp(1,0)=21.2 temp(2,0)=19.3 temp(3,0)=21.1 ....
temp(0,1)=1 temp(1,1)=21.1 temp(2,1)=19,3 temp(3,1)=21.1...
temp(0,2)=2 ....
.
.
.
And i use the function
Call layer.addDataSet(temp , &Hff0000)
to create 8 graphs
1 want to create 1 grph for each column
I have an error type
Is it possible to use this matrix to create 8 graphs.
Thanks for you help.
Boboss |
Re: make a graph with a matrice |
Posted by Peter Kwan on Jul-18-2012 06:36 |
|
Hi Boboss,
For data, ChartDirector expects them to be array variables, so you would need to copy the data from your matrix into arrays.
I am not sure if you are writing an ASP/VBScript application or a VB6 application. The following example assumes it is a VB6 application. Also, for "8 graphs", I assume you mean 8 separate bar charts.
Suppose you have 8 ChartViewer controls on the VB6 Form to display the 8 charts. The code is like:
ReDim myData(UBound(temp, 1) - 1)
'Copy from matrix to data array and create the chart
For i = 0 To Ubound(temp, 2)
For j = 1 To Ubound(temp, 1)
myData(j) = temp(j, i)
Next
Call createChart(i, myData, ChartViewer(i))
Next
In the above, createChart is a subroutine to create a single chart. An example is:
Sub createChart(ByVal i, ByVal myData, viewer As Object)
'
' Same as the simple bar chart sample code
'
Dim c As XYChart
Set c = cd.XYChart(250, 250)
Call c.setPlotArea(30, 20, 200, 200)
Call c.addBarLayer(data)
Set viewer.Picture = c.makePicture()
End Sub
Hope this can help.
Regards
Peter Kwan |
Re: make a graph with a matrice |
Posted by Boboss on Jul-19-2012 18:36 |
|
Thanks for you help
I resolve my problem.
I use the same method. I use an another matrix.I built the graph for each loop .
Excellent idea
Thanks you very much Peter |
|