LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 50
Default Axes on chart in UserForm

I'm trying, with limited success, to put labels on the charts on both the X
and Y Axes I have in a UserForm, and to make the option buttons do the right
thing. Everything I've tried to put the labels in has errored out. Also, My
boss would like to be able to see either the 2008 product chart or the 2009
chart or both. I put option buttons, and they work, except when you switch
from one to the other it doesn't clear the other one, just adds to it,
meaning there is now one of each. If you click back on the first one you get
three, then four, and so on (I haven't even tried to make it go side-by-side
yet. I'm confused enough already). Below is the code behind one of the option
buttons. I would greatly, greatly appreciate any assistance.

Private Sub OptionButton1_Click()
If OptionButton1.Enabled = True Then
Dim ChtSpc As OWC11.ChartSpace
Dim cht As OWC11.ChChart
Dim Sps As OWC11.Spreadsheet
Dim ws As Worksheet

Set ChtSpc = Me.ChartSpace1
Set Sps = Me.Spreadsheet1
Set ws = ThisWorkbook.ActiveSheet ' change to your worksheet name

Sps.Range("A1:AZ48") = ws.Range("A1:AZ48").Value ' Set worksheet range to
sheet control range
Set ChtSpc.DataSource = Sps ' set sheet control as chart control source
Set cht = ChtSpc.Charts.Add ' Add blank chart

' Set data for chart
With cht
.SetData chDimCategories, 0, "C19:C46" ' change to your category
range
.SeriesCollection(0).SetData chDimValues, 0, "E19:E46" ' change to
your series 1 range
.SeriesCollection.Add
.SeriesCollection(1).SetData chDimValues, 0, "T19:T46" ' change to
your series 2 range
.SeriesCollection.Add
.SeriesCollection(2).SetData chDimValues, 0, "AJ19:AJ46" ' change to
your series 3 range
.HasTitle = True
.Title.Caption = Sps.Range("B5") ' change to your title cell
.Type = chChartTypeLine
.HasLegend = True
.SeriesCollection(0).Caption = "ALG"
.SeriesCollection(1).Caption = "Pros"
.SeriesCollection(2).Caption = "Recommended"
.Legend.Position = chLegendPositionBottom
.Legend.Interior.SetOneColorGradient chGradientHorizontal,
chGradientVariantCenter, 0.5, "White"


End With

' hide the sheet control
Me.Spreadsheet1.Visible = False
' set the height of the chart control
Me.ChartSpace1.Height = 215
End If
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...chart/200808/1

 
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
trying to swap axes on chart sssssmmmmm Charts and Charting in Excel 4 October 9th 07 02:18 PM
Bar chart with Y Axes Categories MB Charts and Charting in Excel 6 February 20th 07 09:58 PM
Having two X-axes on same chart Boon8888 Excel Discussion (Misc queries) 1 March 23rd 06 08:49 PM
XY-Chart with 4 axes monir Charts and Charting in Excel 3 December 3rd 05 09:57 PM
Is it possible to create 3 Y-axes in one chart? Rajan Varadan Charts and Charting in Excel 1 May 27th 05 04:04 PM


All times are GMT +1. The time now is 11:43 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"