ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Simple X/Y Chart. (https://www.excelbanter.com/charts-charting-excel/190698-simple-x-y-chart.html)

Kevin Burton

Simple X/Y Chart.
 
This is an extremly basic question but I have spent too much time trying to
figure it out.

I would like to chart a simple X/Y graph. However when I select a chart type
of XlChartType.xlLine it uses the first column in the array as a Y value
array. I would like to have the first column in the array to be the X values
and each subsequent column in the range to be Y1, Y2, etc. If I specify the
first column to be a date then it does just what I want. But if I specify the
first column to be say an integer or double then Excel seems to think that
this is one of the Y values. I just want a plot with the X values taken from
the first column and the Y values taken from the subsequent columns, with a
legend for each of the Y column values and the Y values connected with a
line. Like I said just like it does when the first column is a date.

Thank you.

Kevin

Jon Peltier

Simple X/Y Chart.
 
xlLine is not an XY chart, it is a line chart. Except for when the X values
are dates, the X values are treated as nonnumeric text labels.

Look for something like xlXYScatter or xlXYScatterLine.

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


"Kevin Burton" wrote in message
...
This is an extremly basic question but I have spent too much time trying
to
figure it out.

I would like to chart a simple X/Y graph. However when I select a chart
type
of XlChartType.xlLine it uses the first column in the array as a Y value
array. I would like to have the first column in the array to be the X
values
and each subsequent column in the range to be Y1, Y2, etc. If I specify
the
first column to be a date then it does just what I want. But if I specify
the
first column to be say an integer or double then Excel seems to think that
this is one of the Y values. I just want a plot with the X values taken
from
the first column and the Y values taken from the subsequent columns, with
a
legend for each of the Y column values and the Y values connected with a
line. Like I said just like it does when the first column is a date.

Thank you.

Kevin




Kevin Burton

Simple X/Y Chart.
 
Will this type automatically create legends based on the column header
values? I found a work-around by making the X values "text" and formatting on
my own. This seems to work.

Thank you.

Kevin

"Jon Peltier" wrote:

xlLine is not an XY chart, it is a line chart. Except for when the X values
are dates, the X values are treated as nonnumeric text labels.

Look for something like xlXYScatter or xlXYScatterLine.

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


"Kevin Burton" wrote in message
...
This is an extremly basic question but I have spent too much time trying
to
figure it out.

I would like to chart a simple X/Y graph. However when I select a chart
type
of XlChartType.xlLine it uses the first column in the array as a Y value
array. I would like to have the first column in the array to be the X
values
and each subsequent column in the range to be Y1, Y2, etc. If I specify
the
first column to be a date then it does just what I want. But if I specify
the
first column to be say an integer or double then Excel seems to think that
this is one of the Y values. I just want a plot with the X values taken
from
the first column and the Y values taken from the subsequent columns, with
a
legend for each of the Y column values and the Y values connected with a
line. Like I said just like it does when the first column is a date.

Thank you.

Kevin





Jon Peltier

Simple X/Y Chart.
 
In general, the SetSourceData method defines category values and series
names (legend entries) for a properly defined rata range. Otherwise you can
use the .Name, .XValues, and .Values property of each series.

What's "properly defined"? In a line or column chart, if the first column is
text or dates, it will be assigned to category labels. To make it easier for
Excel to figure out what you want, put a column header label above every
column of Y values, and keep the cell above the column of X values blank.

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


"Kevin Burton" wrote in message
...
Will this type automatically create legends based on the column header
values? I found a work-around by making the X values "text" and formatting
on
my own. This seems to work.

Thank you.

Kevin

"Jon Peltier" wrote:

xlLine is not an XY chart, it is a line chart. Except for when the X
values
are dates, the X values are treated as nonnumeric text labels.

Look for something like xlXYScatter or xlXYScatterLine.

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


"Kevin Burton" wrote in message
...
This is an extremly basic question but I have spent too much time
trying
to
figure it out.

I would like to chart a simple X/Y graph. However when I select a chart
type
of XlChartType.xlLine it uses the first column in the array as a Y
value
array. I would like to have the first column in the array to be the X
values
and each subsequent column in the range to be Y1, Y2, etc. If I specify
the
first column to be a date then it does just what I want. But if I
specify
the
first column to be say an integer or double then Excel seems to think
that
this is one of the Y values. I just want a plot with the X values taken
from
the first column and the Y values taken from the subsequent columns,
with
a
legend for each of the Y column values and the Y values connected with
a
line. Like I said just like it does when the first column is a date.

Thank you.

Kevin








All times are GMT +1. The time now is 08:24 PM.

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