A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Scatter Chart Axis as text in C# Web appl



 
 
Thread Tools Display Modes
  #1  
Old March 28th, 2005, 05:21 PM
Pavr1
external usenet poster
 
Posts: n/a
Default Scatter Chart Axis as text in C# Web appl

Hi,
I've created a Scatter Chart in OWC11 in C# and the X axis must display
dates instead of numbers, I do it using the code below:

....
string x= "10/2/2004 12:00:00 AM\t10/2/2004 12:00:00 AM\t10/5/2004 12:00:00
AM\t10/5/2004 12:00:00 AM\t10/6/2004 12:00:00 AM\t10/7/2004 12:00:00
AM\t10/8/2004 12:00:00 AM\t";
string y = 1\t2\t76\t67\t....";

objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimCategories ,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, "Scatter Charts Series
1");
objChart.SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimXValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, x);
objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, y);
....

whe I do this, somehow the X axis doesn't display the current dates in the
variable x and so the points position is wrong... so what I did is to change
the dates in the x variable into numbers. That way did work out but it didn't
display the dates in the x axis... (Example below)

....
x= "5\t7\t78\t23\t23\t85\t....";
y = 1\t2\t76\t67\t....";

objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimCategories ,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, "Scatter Charts Series
1");
objChart.SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimXValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, x);
objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, y);
....

I have no clue about using a Scatter Chart with a date format axis... can
you please tell me any way to do that please?

pavr1
  #2  
Old March 31st, 2005, 05:28 AM
Jon Peltier
external usenet poster
 
Posts: n/a
Default

I can't read French (I mean C#/OWC), so I don't know what a lot of your
post means, but I've included a few comments in line.

Pavr1 wrote:

Hi,
I've created a Scatter Chart in OWC11 in C# and the X axis must display
dates instead of numbers, I do it using the code below:

...
string x= "10/2/2004 12:00:00 AM\t10/2/2004 12:00:00 AM\t10/5/2004 12:00:00
AM\t10/5/2004 12:00:00 AM\t10/6/2004 12:00:00 AM\t10/7/2004 12:00:00
AM\t10/8/2004 12:00:00 AM\t";
string y = 1\t2\t76\t67\t....";

objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimCategories ,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, "Scatter Charts Series
1");
objChart.SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimXValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, x);
objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, y);
...

whe I do this, somehow the X axis doesn't display the current dates in the
variable x and so the points position is wrong... so what I did is to change
the dates in the x variable into numbers. That way did work out but it didn't
display the dates in the x axis... (Example below)

...
x= "5\t7\t78\t23\t23\t85\t....";
y = 1\t2\t76\t67\t....";


Is this a funny way to write {5, 7, 78, 23, 23,...} ? I was thinking
that you might really have dates, but the number format was not set up
to display the numbers as dates. But these are not the dates that Excel
knows (I can't speak to OWC dates).

objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimCategories ,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, "Scatter Charts Series
1");
objChart.SeriesCollection[0].SetData
(OWC11.ChartDimensionsEnum.chDimXValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, x);
objChart.SeriesCollection[0].SetData(OWC11.ChartDimensionsEnum.chDimYValues,
(int)OWC11.ChartSpecialDataSourcesEnum.chDataLiter al, y);
...

I have no clue about using a Scatter Chart with a date format axis... can
you please tell me any way to do that please?


In Excel, a Scatter chart just has a numeric axis, but you can format
the numbers as dates. You can't get nice ticks at nonuniform spacing,
like the first of every month, because the major tick spacing must be
equal, and months don't work out that way. In Excel, you can use a Line
chart, which will give you a tick and a label at nonuniform places, like
1-Jan, 1-Feb, etc. This unfortunate nomenclature ("scatter" vs. "line")
confuses about 97% of Excel users, who think a line chart is for points
with connecting lines and a scatter chart is for points without
connecting lines; in reality the difference is between a numeric X axis
(scatter chart) or a category or time scale X axis (line chart).

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




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scatter Chart Axis as text C# Pablo Villalobos via OfficeKB.com Charts and Charting 1 March 18th, 2005 10:10 PM
Scatter Chart with non-numeric values on X axis penasm Charts and Charting 1 October 28th, 2004 04:59 PM
force graph to axis of choice bbxrider Charts and Charting 2 February 12th, 2004 09:51 PM
Text boxes-help Jon Peltier Charts and Charting 0 January 26th, 2004 05:46 PM
data to chart on primary axis jw Charts and Charting 6 September 24th, 2003 12:46 AM


All times are GMT +1. The time now is 07:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.