Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MSChart-Plotting 1000 points

Posted on 2003-02-20
2
Medium Priority
?
881 Views
Last Modified: 2012-05-04
I've been pondering on this problem for some time now, maybe you can easily solve it for me. That would be terrific.
I'm plotting a graph with 2 curves on it that contain 1000 points. The problem is that I only want 4 rows displayed on the graph, not 1000. How do I do this? This is my code:

    For lRow = 0 To UBound(FirstDerivate) - 1 '0 -999
        For lCol = 0 To 2
            Select Case lCol
                Case 0  ' Get the concentration
                    vArray(lRow, lCol) = _
              Str(CalCurveData(lRow + 2)) 'x -axis values
                Case 1  ' Get the respons values
                    vArray(lRow, lCol) = _
              CalculatedResp(lRow + 2)
                Case 2  ' Get the derivatives
                    vArray(lRow, lCol) = _
                FirstDerivate(lRow)
            End Select
        Next lCol
    Next lRow
    ' Create the chart
    With GraphForm.MSChart1
        .chartType = VtChChartType2dLine
        '.RowCount = 4   (does not do any difference)
        '.ColumnCount = 2
        .ChartData = vArray
    End With

    ' Configure the chart.
    With GraphForm.MSChart1
        .TitleText = "Calibration curve"
        .Title.VtFont.Name = "Arial"
        .Title.VtFont.Style = VtFontStyleBold
        .Title.VtFont.size = 12
        'set chart labels
        .Plot.Axis(VtChAxisIdX).Labels(1).Auto = False
        .Plot.Axis(VtChAxisIdX).Labels(1).TextLayout.Orientation = VtOrientationHorizontal
        .Plot.Axis(VtChAxisIdX).Labels(1).TextLayout.VertAlignment = VtVerticalAlignmentCenter
        .Plot.Axis(VtChAxisIdX).Labels(1).TextLayout.WordWrap = True
        .Plot.Axis(VtChAxisIdX).AxisTitle.Text = "Conc"
        .Plot.Axis(VtChAxisIdX).AxisTitle.VtFont.Name = "Arial"
        .Plot.Axis(VtChAxisIdX).AxisTitle.VtFont.VtColor.Set 0, 120, 0
        .Plot.Axis(VtChAxisIdY).AxisTitle.Text = "Res/Der"
        .Plot.Axis(VtChAxisIdY).AxisTitle.VtFont.Name = "Arial"
        .Plot.Axis(VtChAxisIdY).AxisTitle.VtFont.VtColor.Set 0, 120, 0
        'Y-axis is linnear, x-axis logarithmic
        .Plot.Axis(VtChAxisIdY).AxisScale.Type =VtChScaleTypeLinear
        .Plot.Axis(VtChAxisIdX).AxisScale.Type =VtChScaleTypeLogarithmic
        'Set color of response line to blue
        With .Plot.SeriesCollection(1).Pen.VtColor
            .Blue = 200
            .Green = 0
            .Red = 0
        End With
        'Set color of derivative line to red
        With .Plot.SeriesCollection(2).Pen.VtColor
            .Blue = 0
            .Green = 0
            .Red = 200
        End With
        'setup legend
        .ShowLegend = True
        .Plot.SeriesCollection(1).LegendText= "Response"
        .Plot.SeriesCollection(2).LegendText= "Derivative"
    End With

Thanks/Ingela
0
Comment
Question by:Ingela
2 Comments
 
LVL 18

Accepted Solution

by:
Sethi earned 225 total points
ID: 7986808
Why iterate 999 times if you want only 4 values to be plotted. Change this statement :  For lRow = 0 To UBound(FirstDerivate) - 1 '0 -999 to the following:
 For lRow = 0 To 3
0
 

Author Comment

by:Ingela
ID: 7987300
True, I could do that. Just found an even better solution.
Thanks anyway. Better:


MSChart1.ChartType = VtChChartType2dLine
With MSChart1.Plot.Axis(VtChAxisIdX)
      .ValueScale.MajorDivision = 10
      .ValueScale.MinorDivision = 5
      .CategoryScale.Auto = False          ' Sets manual scaling.
      .CategoryScale.DivisionsPerLabel = 2 ' Label appears every two
                                           ' divisions.
      .CategoryScale.DivisionsPerTick = 2  ' Ticks appear every two
                                           ' divisions.
      .CategoryScale.LabelTick = True   ' Labels displayed on top of
                                       ' Tick marks.
End With
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question