Re: How to plot Double values graph with MSChART
- From: ranaarvind <ranaarvind@xxxxxxxxx>
- Date: Mon, 13 Aug 2007 04:37:25 -0000
On Aug 12, 1:12 am, dpb <n...@xxxxxxx> wrote:
ranaarvind wrote:
I am able to draw the graph But the problem is that i am not able to
show decimal Variation in my Graph.How to use the datagrid in graph
for double values.
From MSChart Control help files...
"The MSChart control provides a ChartData property for loading data
directly from an array into the data grid. ...
...
Option Base 1
Dim X(3,3) As Variant
For i = 2 To 3
For j = 2 To 3
X(i, j) = i * j
Next j
Next i
'Set the row labels.
X(1, 2) = "Wheat"
X(1, 3) = "Corn"
'Set the column labels.
X(2, 1) = "January"
X(3, 1) = "February"
'Set the chart data.
MSChart1 = X
...
In this example, we used a Variant data type array where the top row and
left column are set to string variables and the lower right 2 by 2
submatrix is set to numeric values. This allows both the chart's labels
and data to be set simultaneously. Note that declaring the array as
String works as long as the lower-right submatrix contains text
representations of numeric values.
If you wish only to set the chart's data, the array may be of the
numeric types Integer, Long, Single, or Double. Note that doing this
will replace the existing chart labels with default row/column labels.
..."
Note in the above I fixed some obvious errors/typos in the definition of
and loading the array, but nothing from what is in the help files, but
nothing that isn't pretty obvious from simply reading the code.
Note the last paragraph above says you can use any of the standard
native numeric data types for the data array as well as Variant but then
the labels will have to be set manually if you want other than default
values. Another poor design "feature" (amongst many) of the MSChart
control, but there's absolutely nothing limiting as for display Double
as a numeric type.
So, unless you can provide a more concrete definition of the problem, I
can't see what the problem might be...
--
Value that is plotted
it is doing decimal approximation
for value > 1.5 it is taking as 2
for value < 1.5 it is taking as 1
Code for Drawing Graph
Private Sub Form_Load()
With MSChart1
..ColumnCount = 2
..chartType = VtChChartType2dXY
..Plot.UniformAxis = False
..Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
..Plot.Axis(VtChAxisIdX).ValueScale.MajorDivision = 10
..Plot.Axis(VtChAxisIdX).ValueScale.Maximum = EndFrequency
..Plot.Axis(VtChAxisIdX).ValueScale.Minimum = StartFrequency
..Plot.Axis(VtChAxisIdX).AxisTitle.Text = "Frequency Ranje"
..Plot.Axis(VtChAxisIdX).Pen.VtColor.Blue = True
..Plot.Projection = VtProjectionTypeOblique
..Plot.Axis(VtChAxisIdX).Tick.Style = VtChAxisTickStyleOutside
..Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
'.Plot.Axis(VtChAxisIdY).CategoryScale.Auto = True
'.Plot.Axis(VtChAxisIdY).CategoryScale.LabelTick = True
..Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = 10
..Plot.Axis(VtChAxisIdY).ValueScale.Maximum = 40
'.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = 100
..Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypeLinear
..Plot.PlotBase.Pen.VtColor.Blue = True
..Plot.Axis(VtChAxisIdY).AxisTitle.Text = "SNR Value"
..Plot.Axis(VtChAxisIdY).Pen.VtColor.Blue = True
..Plot.DataSeriesInRow = False
'.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 10
..Plot.Wall.Pen.VtColor.Blue = True
..Legend.TextLayout.HorzAlignment = 2
..AllowDithering = True
..ShowLegend = True
..Title.Text = "Tuner Performance Graph"
..Legend.TextLayout.WordWrap = True
..Legend.Location.LocationType = VtChLocationTypeLeft
..Legend.VtFont.VtColor.Blue = True
..Legend.Location.Rect.Max.Set 7560, 5132
..Legend.Location.Rect.Min.Set 1004, 4864
..Legend.VtFont.Style = VtFontStyleOutline
..Plot.UniformAxis = False
UpperBound = UpperBound + 1
ReDim Graph(1 To UpperBound, 1 To 2) As Variant
Dim xm As Variant
Graph_Counter = 0
For xm = 1 To UpperBound Step 1
Graph_Counter = Graph_Counter + 1
Graph(xm, 1) = Graph_freq(Graph_Counter) 'xm '
value for X-axis
Graph(xm, 2) = Format(Graph_Snr(Graph_Counter), "##0.00") ' value
for Y-axis
Next xm
MSChart1.Plot.UniformAxis = False
'MSChart1.ChartData = Graph ' populate chart's data grid using Graph
array
End With
End Sub
.
- Follow-Ups:
- References:
- How to plot Double values graph with MSChART
- From: ranaarvind
- Re: How to plot Double values graph with MSChART
- From: dpb
- How to plot Double values graph with MSChART
- Prev by Date: [On Error] error handling?
- Next by Date: Re: Shortest possible one-liner to get number of days in a month
- Previous by thread: Re: How to plot Double values graph with MSChART
- Next by thread: Re: How to plot Double values graph with MSChART
- Index(es):
Relevant Pages
|