Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default VB script line graph

I am trying to create linechart through vb script

here is my data

06:00 200 05/01/2009
06:30 250 05/01/2009
07:00 300 05/01/2009
07:30 450 05/01/2009
....
....
.....
...

06:00 130 05/02/2009
06:30 220 05/02/2009
07:00 320 05/02/2009
07:30 450 05/02/2009
....
.....
......


This is my spreadsheet, to start with I am taking only two days

trying to draw line chart to display how pattern is

here is my code

ActiveWorkbook.Charts.Add
With ActiveWorkbook.ActiveChart
.ChartType = xlLineStacked
Dim i As Integer
Dim j As Integer
Dim rn As String
Dim rn2 As String
Dim TIT As String
Dim k As Integer
i = 2
k = 0
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C61"),
PlotBy :=xlColumns

' xlsAxisCategory = .Axes(, Excel.XlAxisGroup.xlPrimary)
Set objSheet = ActiveWorkbook.Sheets("Sheet1")

Do While objSheet.Range("A" & i).Value < ""
If objSheet.Range("A" & i).Value = "06:00:00 AM" Then
TIT = Format(objSheet.Range("c" & i), "Long Date")
j = i + 29
rn = "R" & j & "C2:" & "R" & i & "C2"
k = k + 1
ActiveWorkbook.ActiveChart.SeriesCollection.NewSer ies
ActiveWorkbook.ActiveChart.SeriesCollection(k).Nam e = TIT
ActiveWorkbook.ActiveChart.SeriesCollection(k).Val ues =
"=Sheet1!" & rn 'Sheets("sheet1").Range(rn)
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R32C1:R61C1"

End If


i = i + 1
Loop
.Refresh


what i am doing is, two series for two dates. only changing values for same
category (x) axis
I do manually i am getting graph they way I want, when use above script,
first series is correct but
for second series, it is ploting graph by combing both date values.

can any one help me to solve

Thanks
K

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default VB script line graph

Any help

Thanks


"Kalyan" wrote:

I am trying to create linechart through vb script

here is my data

06:00 200 05/01/2009
06:30 250 05/01/2009
07:00 300 05/01/2009
07:30 450 05/01/2009
...
...
....
..

06:00 130 05/02/2009
06:30 220 05/02/2009
07:00 320 05/02/2009
07:30 450 05/02/2009
...
....
.....


This is my spreadsheet, to start with I am taking only two days

trying to draw line chart to display how pattern is

here is my code

ActiveWorkbook.Charts.Add
With ActiveWorkbook.ActiveChart
.ChartType = xlLineStacked
Dim i As Integer
Dim j As Integer
Dim rn As String
Dim rn2 As String
Dim TIT As String
Dim k As Integer
i = 2
k = 0
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C61"),
PlotBy :=xlColumns

' xlsAxisCategory = .Axes(, Excel.XlAxisGroup.xlPrimary)
Set objSheet = ActiveWorkbook.Sheets("Sheet1")

Do While objSheet.Range("A" & i).Value < ""
If objSheet.Range("A" & i).Value = "06:00:00 AM" Then
TIT = Format(objSheet.Range("c" & i), "Long Date")
j = i + 29
rn = "R" & j & "C2:" & "R" & i & "C2"
k = k + 1
ActiveWorkbook.ActiveChart.SeriesCollection.NewSer ies
ActiveWorkbook.ActiveChart.SeriesCollection(k).Nam e = TIT
ActiveWorkbook.ActiveChart.SeriesCollection(k).Val ues =
"=Sheet1!" & rn 'Sheets("sheet1").Range(rn)
ActiveChart.SeriesCollection(1).XValues = "=Sheet1!R32C1:R61C1"

End If


i = i + 1
Loop
.Refresh


what i am doing is, two series for two dates. only changing values for same
category (x) axis
I do manually i am getting graph they way I want, when use above script,
first series is correct but
for second series, it is ploting graph by combing both date values.

can any one help me to solve

Thanks
K

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining a 2-D column graph and a 2-D line graph on the same char Filippo Charts and Charting in Excel 3 February 23rd 10 12:34 AM
How to convert a dotted line to a solid line in a line graph Sharlz Charts and Charting in Excel 1 January 14th 09 04:51 AM
How do I graph data daily as a line graph across a calendar format Glani Charts and Charting in Excel 3 November 23rd 07 09:05 AM
Cluster stacked graph AND line combo graph? [email protected] Charts and Charting in Excel 6 October 14th 06 12:33 AM
Excel Graph script the G Charts and Charting in Excel 1 October 11th 05 12:15 PM


All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"