Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Axes(xlCategory).TickLabels problem

When I create a chart (manually or with automation) and define the
xlCategory Axis with 2 columns, the TickLabels appear all scrunched together
and are not readable. The TickLabel text is made up of a date value (from
column A) and a time value (from column B):

"02/27/05 06:47:24"

If I make the chart really wide, both date and time appear horizontal like
this:

02/27/05
06:47:24

But the chart requires a Width of 500 which makes the time portion of the
Ticklabel appear vertical (and readable), but the date portion appears
horizontal and all scrunched together. I've tried changing the
..Axes(xlCategory).TickLabels.Orientation property, but the changes only
apply to the time value (from column B).

Is there a way to get both the date and time to appear vertically so the
entire TickLabel is readable?

Thanks in advance.


Here is the macro code generated when creating the chart manually:

Sub Macro1()
Charts.Add
ActiveChart.ChartType = xlLineMarkersStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C22"), _
PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True
End With
ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Axes(xlCategory).TickLabels problem

You can insert a new column (C) which adds A and B, giving the date and time as a
single number (Excel stores dates as whole numbers and times as fractions of a day,
so adding the two gives a time of a given day).

Make your chart with column C as the category labels, then make sure the axis is a
category, not date-scale, axis: From the Chart menu, choose Chart Options, click on
the Axes tab, and under Category axis, select Category. This last step is important
because a line chart with a time-scale axis ignores the time component, and uses
just the date component for the X value, and all data for a given day is plotted at
midnight.

An alternative is to skip intermediate labels: double click the axis, and on the
Scale tab, change the Number of Categories between Tick Mark Labels.

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

deko wrote:
When I create a chart (manually or with automation) and define the
xlCategory Axis with 2 columns, the TickLabels appear all scrunched together
and are not readable. The TickLabel text is made up of a date value (from
column A) and a time value (from column B):

"02/27/05 06:47:24"

If I make the chart really wide, both date and time appear horizontal like
this:

02/27/05
06:47:24

But the chart requires a Width of 500 which makes the time portion of the
Ticklabel appear vertical (and readable), but the date portion appears
horizontal and all scrunched together. I've tried changing the
..Axes(xlCategory).TickLabels.Orientation property, but the changes only
apply to the time value (from column B).

Is there a way to get both the date and time to appear vertically so the
entire TickLabel is readable?

Thanks in advance.


Here is the macro code generated when creating the chart manually:

Sub Macro1()
Charts.Add
ActiveChart.ChartType = xlLineMarkersStacked
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C22"), _
PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet1"
With ActiveChart
.HasAxis(xlCategory, xlPrimary) = True
.HasAxis(xlValue, xlPrimary) = True
End With
ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = False
End Sub



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
Excel VBA Chart TickLabels djdwwoug Excel Discussion (Misc queries) 6 August 31st 07 09:02 PM
TickLabels djdwwoug Charts and Charting in Excel 2 August 30th 07 12:42 PM
Adjusting the y axes on 2-axes line graphs aqua Charts and Charting in Excel 2 March 3rd 07 04:28 PM
Problem with custom line chart, lines with two axes Dora Smith Charts and Charting in Excel 1 February 7th 07 01:43 PM
problem with column charts and two Y axes in Excel 2003 napofrog Charts and Charting in Excel 1 October 21st 05 03:04 AM


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

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"