A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

x-axis scale changes



 
 
Thread Tools Display Modes
  #1  
Old March 23rd, 2009, 11:29 PM posted to microsoft.public.excel.charting
Laoballer
external usenet poster
 
Posts: 51
Default x-axis scale changes

I have a macro that automatically generates a new chart from data in a
worksheet. When I run my macro, charts that have been created prior
will have the same min x-axis scale as the new chart generated.
However the recently generated chart looks perfect. How do I make the
old charts and new charts independent from each other? Whenever I
create a new chart I'm using the charts.add function


Set xlChart = Charts.Add
With xlChart
.ChartWizard Source:=GanttChartRange, Gallery:=xlBar,
Format:=3, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1,
HasLegend:=1, Title:=Title, CategoryTitle:="", ValueTitle:="",
ExtraTitle:=""
.SeriesCollection(1).Border.LineStyle = xlNone
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlCategory).Crosses = 4 'TaskCount
.Axes(xlValue).MinimumScale = minXscale 'minXscale is a cell
on the worksheet min value of x-axis
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.Size = 10
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.Size = 12
.Legend.Font.Name = "Arial"
.Legend.Font.Size = 12
.HasTitle = True
.ChartTitle.Text = Range("GanttTitle").Value
.ChartTitle.Font.Name = "Arial"
.ChartTitle.Font.Size = 15
.ChartTitle.Font.Bold = False
End With

this code is courtesy of Dave Steppan,
http://www.geocities.com/SiliconVall...1030/gantt.zip

thanks,
  #2  
Old March 24th, 2009, 02:43 AM posted to microsoft.public.excel.charting
Jon Peltier
external usenet poster
 
Posts: 5,018
Default x-axis scale changes

The new charts are perfect, and the old charts are not? What's wrong with
them?

What makes you say that the charts are dependent on one another? There is
some dependence if they use the same data, of course, and if they use the
same minimum date (that's the value/Y axis by the way, not the category/X
axis).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Laoballer" wrote in message
...
I have a macro that automatically generates a new chart from data in a
worksheet. When I run my macro, charts that have been created prior
will have the same min x-axis scale as the new chart generated.
However the recently generated chart looks perfect. How do I make the
old charts and new charts independent from each other? Whenever I
create a new chart I'm using the charts.add function


Set xlChart = Charts.Add
With xlChart
.ChartWizard Source:=GanttChartRange, Gallery:=xlBar,
Format:=3, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1,
HasLegend:=1, Title:=Title, CategoryTitle:="", ValueTitle:="",
ExtraTitle:=""
.SeriesCollection(1).Border.LineStyle = xlNone
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlCategory).Crosses = 4 'TaskCount
.Axes(xlValue).MinimumScale = minXscale 'minXscale is a cell
on the worksheet min value of x-axis
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.Size = 10
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.Size = 12
.Legend.Font.Name = "Arial"
.Legend.Font.Size = 12
.HasTitle = True
.ChartTitle.Text = Range("GanttTitle").Value
.ChartTitle.Font.Name = "Arial"
.ChartTitle.Font.Size = 15
.ChartTitle.Font.Bold = False
End With

this code is courtesy of Dave Steppan,
http://www.geocities.com/SiliconVall...1030/gantt.zip

thanks,



  #3  
Old March 24th, 2009, 03:25 PM posted to microsoft.public.excel.charting
Laoballer
external usenet poster
 
Posts: 51
Default x-axis scale changes

On Mar 23, 7:43*pm, "Jon Peltier"
wrote:
The new charts are perfect, and the old charts are not? What's wrong with
them?

What makes you say that the charts are dependent on one another? There is
some dependence if they use the same data, of course, and if they use the
same minimum date (that's the value/Y axis by the way, not the category/X
axis).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.http://PeltierTech.com/WordPress/
_______

"Laoballer" wrote in message

...

I have a macro that automatically generates a new chart from data in a
worksheet. *When I run my macro, charts that have been created prior
will have the same min x-axis scale as the new chart generated.
However the recently generated chart looks perfect. *How do I make the
old charts and new charts independent from each other? *Whenever I
create a new chart I'm using the charts.add function


* * * *Set xlChart = Charts.Add
* * * *With xlChart
* * * *.ChartWizard Source:=GanttChartRange, Gallery:=xlBar,
Format:=3, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1,
HasLegend:=1, Title:=Title, CategoryTitle:="", ValueTitle:="",
ExtraTitle:=""
* * * *.SeriesCollection(1).Border.LineStyle = xlNone
* * * *.SeriesCollection(1).Interior.ColorIndex = xlNone
* * * *.Axes(xlCategory).ReversePlotOrder = True
* * * *.Axes(xlCategory).Crosses = 4 'TaskCount
* * * *.Axes(xlValue).MinimumScale = minXscale 'minXscale is a cell
on the worksheet min value of x-axis
* * * *.Axes(xlValue).TickLabels.Font.Name = "Arial"
* * * *.Axes(xlValue).TickLabels.Font.Size = 10
* * * *.Axes(xlCategory).TickLabels.Font.Name = "Arial"
* * * *.Axes(xlCategory).TickLabels.Font.Size = 12
* * * *.Legend.Font.Name = "Arial"
* * * *.Legend.Font.Size = 12
* * * *.HasTitle = True
* * * *.ChartTitle.Text = Range("GanttTitle").Value
* * * *.ChartTitle.Font.Name = "Arial"
* * * *.ChartTitle.Font.Size = 15
* * * *.ChartTitle.Font.Bold = False
* *End With


this code is courtesy of Dave Steppan,
http://www.geocities.com/SiliconVall...1030/gantt.zip


thanks,


You're right, the charts are dependent on the min x value. How do I
make it so that when each chart is created it no longer take on the
min x value in the vba code after it finishes?
  #4  
Old March 24th, 2009, 09:51 PM posted to microsoft.public.excel.charting
Jon Peltier
external usenet poster
 
Posts: 5,018
Default x-axis scale changes

To remove the hard-coded minimum, stop setting it, that is, remove this line
of code:

.Axes(xlValue).MinimumScale = minXscale 'minXscale is a cell

In an existing chart, right click on the axis, choose Format, and change the
scale so it is automatic, not fixed to the value you set.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______



"Laoballer" wrote in message
...
On Mar 23, 7:43 pm, "Jon Peltier"
wrote:
The new charts are perfect, and the old charts are not? What's wrong with
them?

What makes you say that the charts are dependent on one another? There is
some dependence if they use the same data, of course, and if they use the
same minimum date (that's the value/Y axis by the way, not the category/X
axis).

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.http://PeltierTech.com/WordPress/
_______

"Laoballer" wrote in message

...

I have a macro that automatically generates a new chart from data in a
worksheet. When I run my macro, charts that have been created prior
will have the same min x-axis scale as the new chart generated.
However the recently generated chart looks perfect. How do I make the
old charts and new charts independent from each other? Whenever I
create a new chart I'm using the charts.add function


Set xlChart = Charts.Add
With xlChart
.ChartWizard Source:=GanttChartRange, Gallery:=xlBar,
Format:=3, PlotBy:=xlColumns, CategoryLabels:=1, SeriesLabels:=1,
HasLegend:=1, Title:=Title, CategoryTitle:="", ValueTitle:="",
ExtraTitle:=""
.SeriesCollection(1).Border.LineStyle = xlNone
.SeriesCollection(1).Interior.ColorIndex = xlNone
.Axes(xlCategory).ReversePlotOrder = True
.Axes(xlCategory).Crosses = 4 'TaskCount
.Axes(xlValue).MinimumScale = minXscale 'minXscale is a cell
on the worksheet min value of x-axis
.Axes(xlValue).TickLabels.Font.Name = "Arial"
.Axes(xlValue).TickLabels.Font.Size = 10
.Axes(xlCategory).TickLabels.Font.Name = "Arial"
.Axes(xlCategory).TickLabels.Font.Size = 12
.Legend.Font.Name = "Arial"
.Legend.Font.Size = 12
.HasTitle = True
.ChartTitle.Text = Range("GanttTitle").Value
.ChartTitle.Font.Name = "Arial"
.ChartTitle.Font.Size = 15
.ChartTitle.Font.Bold = False
End With


this code is courtesy of Dave Steppan,
http://www.geocities.com/SiliconVall...1030/gantt.zip


thanks,


You're right, the charts are dependent on the min x value. How do I
make it so that when each chart is created it no longer take on the
min x value in the vba code after it finishes?


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:33 PM.


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