Solved

Line Graph

Posted on 2001-08-30
7
294 Views
Last Modified: 2012-06-27
Does anyone know how 2 make a continous line graph that has different values along in in different colours
- like a stacked bar graph does
0
Comment
Question by:Joana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 8

Expert Comment

by:glass_cookie
ID: 6443415
Hi!

One way (never done anything with graphs, but just in case it helps) is to do something like:

Use a line control with it's drawmode/pen (can't really remember which property it is) set to invert.

This would cause whatever that's behind it to be another colour.

Hope this helps!

That's it!

glass cookie : )
0
 
LVL 3

Expert Comment

by:adg
ID: 6443789
I know how to make a line graph in different colors. But I don't quite grasp what you want to do. Do you mean that you want part of the line a different color than another part? Or do you mean that you want the data points on the line marked in different colors? Or something else?  Would you explain further?  
0
 
LVL 3

Accepted Solution

by:
adg earned 200 total points
ID: 6443815
Just a guess at what your looking for.  Is it close?  You have to add the Microsoft Chart Control to your project to use this code.  

Option Explicit
Private gArray(1 To 13, 1 To 6)

Private Sub Form_Load()
    Dim i As Integer
    Randomize Timer
    MSChart1.Plot.UniformAxis = False
    MSChart1.chartType = VtChChartType2dXY
    For i = 1 To 5
        gArray(i, 1) = i
        gArray(i, 2) = Rnd
    Next i
    gArray(5, 3) = 5
    gArray(5, 4) = gArray(5, 2)
    For i = 6 To 10
        gArray(i, 3) = i
        gArray(i, 4) = Rnd
    Next i
    gArray(10, 5) = 10
    gArray(10, 6) = gArray(10, 4)
    For i = 11 To 13
        gArray(i, 5) = i
        gArray(i, 6) = Rnd
    Next i
    MSChart1 = gArray
End Sub

Private Sub Form_Resize()
    MSChart1.Move ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight
End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:adg
ID: 6443824
or more like this...?

' Example #2
Option Explicit
Private gArray(1 To 13, 1 To 6)
Private Sub Form_Load()
    Dim i As Integer
    Randomize Timer
    MSChart1.Plot.UniformAxis = False
    MSChart1.chartType = VtChChartType2dXY
    For i = 1 To 13
        gArray(i, 1) = i
        gArray(i, 2) = Rnd * 2 + 1
        gArray(i, 3) = i
        gArray(i, 4) = Rnd * 3 + 2
        gArray(i, 5) = i
        gArray(i, 6) = Rnd * 4 + 3
    Next i
    MSChart1 = gArray
End Sub
Private Sub Form_Resize()
    MSChart1.Move ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight
End Sub
0
 
LVL 3

Expert Comment

by:adg
ID: 6449320
How about this one?

' Example #3

Option Explicit
Private garray(1 To 6, 1 To 2)

Private Sub Form_Load()
    Dim d As Integer, s As Integer
    For s = LBound(garray, 2) To UBound(garray, 2) ' series
        For d = LBound(garray, 1) To UBound(garray, 1) ' datapoints
            garray(d, s) = d * s
        Next d
    Next s
    With MSChart1
        .chartType = VtChChartType2dLine
        .ChartData = garray
        .Plot.SeriesCollection(1).Position.Order = 1 ' series 1 and 2 are stacked
        .Plot.SeriesCollection(2).Position.Order = 1 ' because the order is the same
    End With
End Sub

Private Sub Form_Resize()
    MSChart1.Move ScaleLeft, ScaleTop, ScaleWidth, ScaleHeight
End Sub
0
 

Author Comment

by:Joana
ID: 6454627
i figured out how 2 do it (i was using Actuate so couldn't do it normally) but i thought i'd give u the points anyway since u had such a rad answer :-)
0
 
LVL 3

Expert Comment

by:adg
ID: 6455663
Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

756 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