Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

msChart : Stacked / not Stacked

Status
Not open for further replies.

cbsm

Programmer
Joined
Oct 3, 2002
Messages
229
Location
FR
Hello,

I am working with VB6.
I started to use MSChart control and so far was able to do what I liked with it.
Now, I am trying to represent on the same chart 3 Series :
First : a line
Second : an area chart, stacked with
Third : an area chart.

So, the line has to be independent (not stacked with the other 2).

(If I have no other solution I will do the "stacking" in my table, with Serie 3 representing 2+3, but I'd rather do it the other way).
Thanks,

 
Hi,

This code will make the 1st series a line and any remaining series will be area. It then sets the order of the series such that the areas are stacked and the line is shown on top of the areas.

Code:
   With MSChart1
      
      .chartType = VtChChartType2dCombination

      For i = 1 To .Plot.SeriesCollection.Count
         With .Plot.SeriesCollection(i)
            If i = 1 Then
                .SeriesType = VtChSeriesType2dLine
                .Position.Order = 1
            Else
                .SeriesType = VtChSeriesType2dArea
                .Position.Order = 2
            End If
         End With
         
      Next i
      
   End With

In developing this I just used the "generic" data that are in the MSChart control when you place it on a form, but it shoud work for what you want.

Let me know if this works out for you.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top