ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   How do I plot two columns of data as one data point/marker in a ch (https://www.excelbanter.com/charts-charting-excel/58006-how-do-i-plot-two-columns-data-one-data-point-marker-ch.html)

Tim L Cole Haan

How do I plot two columns of data as one data point/marker in a ch
 
I want to plot a series of results into a chart as one data point. To
clarify, I have multiple rows with three colums of data. I would like each
row (column one being the Series title column) to be one data point (i.e. Row
One = Store 1, Column 1 = "Store 1", Column 2 = Sales $'s, Column 3 = Profit
%). On the chart I would like the X-Axis to be Profit % and the Y-Axis to be
Sales $'s. The example above, using typical charting functions, results in
two data points for Store 1 (the Sales $ plotted as one point and the Profit
% plotted as another point). I only want one data point where the Sales $
and Profit % meet (i.e. the way you would plot when you were learning
charts/graphs as a kid).

I have found a work around, but it requires manually setting up each Row of
data as its own series and the corresponding name, X and Y Axis variables.

It would be nice if this set-up could be done without so much manual
intervention.

I'm using Excel 2003.

Thanks in advance for any help you can offer!

Tushar Mehta

How do I plot two columns of data as one data point/marker in a ch
 
The only solution I can think of requires VBA. Keep in mind that I
would not implement a solution meant for distribution using the method
below. But, it is the easiest way to get a prototype done.

In the worksheet's code module, put the code below. Then, every time
you select a cell containing data in columns C1:C3 the chart will be
updated.

The code assumes there is only one chart in the worksheet and that it
contains only one series. The name comes from column C1, the x value
from column C2 and the y value from C3.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count < 1 Then Exit Sub
If Target.Column 3 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
Application.EnableEvents = False
On Error Resume Next
Dim aSeries As Series
Set aSeries = _
Target.Parent.ChartObjects(1).Chart.SeriesCollecti on(1)
With Target.Parent
aSeries.Name = .Cells(Target.Row, 1)
aSeries.XValues = .Cells(Target.Row, 2)
aSeries.Values = .Cells(Target.Row, 3)
End With
Application.EnableEvents = True
End Sub


--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , =?Utf-
8?B?VGltIEwgQ29sZSBIYWFu?= <Tim L Cole
says...
I want to plot a series of results into a chart as one data point. To
clarify, I have multiple rows with three colums of data. I would like each
row (column one being the Series title column) to be one data point (i.e. Row
One = Store 1, Column 1 = "Store 1", Column 2 = Sales $'s, Column 3 = Profit
%). On the chart I would like the X-Axis to be Profit % and the Y-Axis to be
Sales $'s. The example above, using typical charting functions, results in
two data points for Store 1 (the Sales $ plotted as one point and the Profit
% plotted as another point). I only want one data point where the Sales $
and Profit % meet (i.e. the way you would plot when you were learning
charts/graphs as a kid).

I have found a work around, but it requires manually setting up each Row of
data as its own series and the corresponding name, X and Y Axis variables.

It would be nice if this set-up could be done without so much manual
intervention.

I'm using Excel 2003.

Thanks in advance for any help you can offer!



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com