ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   creating dynamic chart from within VB6 (https://www.excelbanter.com/charts-charting-excel/190477-creating-dynamic-chart-within-vb6.html)

mb

creating dynamic chart from within VB6
 
I'm creating a chart within a Visual Basic 6 program which has 3 series.

The first two series are static, and represent minimum/maximum limits for
the third series, which is a diameter vs. offset graph.

The diameter vs. offset graph will grow as more measurements are taken at
increasing offsets, and I'm looking for a way to construct a
dynamically-expanding graph.

I've read some of the articles and website tutorials from past queries to
this newsgroup, and it sounds like it is pretty easy to do this directly
from Excel.

My question: is there some way to do the same thing from within VB6? I.e.
name a range and use keywords such as OFFSET and SERIES?

Currently, I'm adding the diameter vs. offset graph with code that looks
like this:

With objChart.SeriesCollection.NewSeries
.xValues = objSheet.Range(objSheet.Cells(5, 2), objSheet.Cells(5, cCols))
.Values = objSheet.Range(objSheet.Cells(6, 2), objSheet.Cells(6, cCols))
End With

But I don't want to add a new series everytime I have one more pair of
datapoints to plot.

I know the data series will never be greater than 255 entries, so is there
some way I can specify the entire range, and have it ignore zero entries,
but update when I add non-zero entries within the range?


thanks!

Michael


Jon Peltier

creating dynamic chart from within VB6
 
Instead of referencing a new series, reference the existing series:

With objChart.SeriesCollection(3)
.xValues = objSheet.Range(objSheet.Cells(5, 2), objSheet.Cells(5, cCols))
.Values = objSheet.Range(objSheet.Cells(6, 2), objSheet.Cells(6, cCols))
End With

or

With objChart.SeriesCollection("My Data Series")
.xValues = objSheet.Range(objSheet.Cells(5, 2), objSheet.Cells(5, cCols))
.Values = objSheet.Range(objSheet.Cells(6, 2), objSheet.Cells(6, cCols))
End With


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"mb" wrote in message
...
I'm creating a chart within a Visual Basic 6 program which has 3 series.

The first two series are static, and represent minimum/maximum limits for
the third series, which is a diameter vs. offset graph.

The diameter vs. offset graph will grow as more measurements are taken at
increasing offsets, and I'm looking for a way to construct a
dynamically-expanding graph.

I've read some of the articles and website tutorials from past queries to
this newsgroup, and it sounds like it is pretty easy to do this directly
from Excel.

My question: is there some way to do the same thing from within VB6? I.e.
name a range and use keywords such as OFFSET and SERIES?

Currently, I'm adding the diameter vs. offset graph with code that looks
like this:

With objChart.SeriesCollection.NewSeries
.xValues = objSheet.Range(objSheet.Cells(5, 2), objSheet.Cells(5, cCols))
.Values = objSheet.Range(objSheet.Cells(6, 2), objSheet.Cells(6, cCols))
End With

But I don't want to add a new series everytime I have one more pair of
datapoints to plot.

I know the data series will never be greater than 255 entries, so is there
some way I can specify the entire range, and have it ignore zero entries,
but update when I add non-zero entries within the range?


thanks!

Michael





All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com