![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
I need to display vertical lines in my column chart to mark various limits. I know how to do the column chart programmatically, but how do I add the line chart and make vertical lines with it? Is it possible?
|
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
What does your data look like?
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
I am plotting histogram data with a column chart type. I want to draw vertical lines from the bottom of the plotarea to the top of the plotarea. I want to do this programmatically as I am creating about 40 charts of various test parameters. So the horizontal scale changes from chart to chart. Thanks for the reply
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
I believe I understand what you want... can you provide some sample data? You'll need to use an XY Chart, and then add your vertical lines as separate series. For example, to add a line at X=2.5 enter 2.5 into cell D1, 0 into cell E1, =D1 into D2, and 60 into E2. Set your Y-axis maximum value to 60. Copy D1:E2. Paste | Special... onto the Chart area. Add cells as New Series and check "Category (X Labels) in First Column". Or simply use the formula...
=SERIES(,Sheet1!$D$1:$D$2,Sheet1!$E$1:$E$2,2) [ This Message was edited by: Mark W. on 2002-02-25 10:48 ] |
|
|
|
|
|
#5 |
|
Guest
Posts: n/a
|
Column "A" of my data has the frequency in each data bin and is plotted on the "Y" axis, column "B" has the data bins and is plotted on the "X" axis. Column "C" has the next parameter's frequency data and Column "D" has the next parameter's data bins. Here's the code I use:
ReDim binsArray(0 To Resolution) stepValue = (MaxScale - MinScale) / Resolution For j = 0 To Resolution binsArray(j) = MinScale + stepValue * j FinalChartBook.Worksheets("HistChartData") .Cells(j + 1, 2 * i) = binsArray(j) Next j Set dataRange = .Range(.Cells(5, i), .Cells(NumRows, i)) Set resultsRange = FinalChartBook.Worksheets("HistChartData"). Range(FinalChartBook.Worksheets("HistChartData").Cells(1, (2 * i) - 1), FinalChartBook.Worksheets("HistChartData") .Cells(Resolution + 1, (2 * i) - 1)) resultsRange = finalWB.Application.WorksheetFunction.Frequency(dataRange, binsArray) |
|
|
|
#6 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
See my edited posting above.
|
|
|
|
|
|
#7 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
Can I simulate a column chart with the XY type chart? I want narrow lines for the range markers, but thick bars to display the histogram data.
Thanks for the help |
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Yes, click on any one of your charted histogram values and change it's chart type to Column.
|
|
|
|
|
|
#9 |
|
New Member
Join Date: Feb 2002
Location: Texas Instruments
Posts: 47
|
Would it be easier to just draw line shapes ontop of my column chart, or would that be asking for trouble with resourses, etc.?
|
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|