ASP.NET and Chart Question

L

Luis D Rojas

Hi,
I´m working with the chart control with C#
I´m using a chChartTypeScatterLineMarkers chart type.
The chart works fine, but i do not know why the first point at chart X does
not starts at the (0,0) intersection
It starts to draw the line like 3 month away. And the same happens for the
last point
i´m using Autoscaling property like this
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMaximum = true;
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMinimum = true;

Can somebody help me

thanks in advance
 
A

Alvin Bruney [MVP]

That's not a correct enumeration argument that you are passing to the chAxes
object.
The axes index takes a ChartAxisTypeEnum enumeration. The reason this is
compiling is because the chAxes object accepts an object as a parameter.
I've pointed out in my book that I think this is a sign of a potentially
defective design because it leads to subtle problems like what you see.
Finally, the hasautominimum property that you apply programmatically
determines the lowest value, if 0 is not your minimum value it simply won't
show up

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
 
L

Luis D Rojas

Thanks, I think i fixed with your information.
Can you tell me whay my chart does not starts in the first value of my set
of values. For example, it starts on Feb 22 2004, but if i set the
Scaling.HasAutominimum to true the chart starts at Jan 22 2004, and same
happens for the max value, why it gives that time frame. I need my chart to
start on Feb 22 2004. Do you know how to fix this.

PD/ I looked at your book, it seems to be very good ( from the chapter
sample ), but, do you konw when it is going to be at Amazon?

Alvin Bruney said:
That's not a correct enumeration argument that you are passing to the chAxes
object.
The axes index takes a ChartAxisTypeEnum enumeration. The reason this is
compiling is because the chAxes object accepts an object as a parameter.
I've pointed out in my book that I think this is a sign of a potentially
defective design because it leads to subtle problems like what you see.
Finally, the hasautominimum property that you apply programmatically
determines the lowest value, if 0 is not your minimum value it simply won't
show up

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------


Luis D Rojas said:
Hi,
I´m working with the chart control with C#
I´m using a chChartTypeScatterLineMarkers chart type.
The chart works fine, but i do not know why the first point at chart X
does
not starts at the (0,0) intersection
It starts to draw the line like 3 month away. And the same happens for the
last point
i´m using Autoscaling property like this
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMaximum = true;
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMinimum = true;

Can somebody help me

thanks in advance
 
A

Alvin Bruney [MVP]

I don't know.
If you can produce a short but complete program that demonstrates the
problem I can take a look. Go here for an idea on how to generate a small,
complete program http://www.yoda.arachsys.com/csharp/complete.html
PD/ I looked at your book, it seems to be very good ( from the chapter
sample ), but, do you konw when it is going to be at Amazon?

Amazon/Barnes and Noble 15th March 2005

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------


Luis D Rojas said:
Thanks, I think i fixed with your information.
Can you tell me whay my chart does not starts in the first value of my set
of values. For example, it starts on Feb 22 2004, but if i set the
Scaling.HasAutominimum to true the chart starts at Jan 22 2004, and same
happens for the max value, why it gives that time frame. I need my chart
to
start on Feb 22 2004. Do you know how to fix this.

PD/ I looked at your book, it seems to be very good ( from the chapter
sample ), but, do you konw when it is going to be at Amazon?

Alvin Bruney said:
That's not a correct enumeration argument that you are passing to the
chAxes
object.
The axes index takes a ChartAxisTypeEnum enumeration. The reason this is
compiling is because the chAxes object accepts an object as a parameter.
I've pointed out in my book that I think this is a sign of a potentially
defective design because it leads to subtle problems like what you see.
Finally, the hasautominimum property that you apply programmatically
determines the lowest value, if 0 is not your minimum value it simply
won't
show up

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------


Luis D Rojas said:
Hi,
I´m working with the chart control with C#
I´m using a chChartTypeScatterLineMarkers chart type.
The chart works fine, but i do not know why the first point at chart X
does
not starts at the (0,0) intersection
It starts to draw the line like 3 month away. And the same happens for
the
last point
i´m using Autoscaling property like this
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMaximum = true;
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMinimum = true;

Can somebody help me

thanks in advance
 
L

Luis D Rojas

Hi, Here is the code:
The problem is with the X Axe, which contains Dates that are taken from a
Access Database.
Y Axe is a set of double values, no problem here.
The cmdCount object gets the total regs in the Table that matches the
criteria for miCommand object

OleDbConn = new System.Data.OleDb.OleDbConnection( strConn );
OleDbCommand miCommand = new OleDbCommand( strSql, OleDbConn );
OleDbCommand cmdCount = new OleDbCommand( strSqlCount, OleDbConn );
OleDbDataReader dr;
OleDbConn.Open();
int totalReg = (int)cmdCount.ExecuteScalar();
object[] arrX = new object[totalReg];
object[] arrY = new object[totalReg];
while ( dr.Read() )
{
arrX = dr.GetValue(1);
arrY=dr.GetValue(2);
}
OWC10.ChartSpace cspace = new OWC10.ChartSpace();
OWC10.ChChart cht = cspace.Charts.Add(0);
cht.Type = OWC10.ChartChartTypeEnum.chChartTypeScatterLineMarkers;
cht.SeriesCollection.Add(0);
cht.SeriesCollection[0].Caption = charYAxis;
cht.SeriesCollection[0].SetData(OWC10.ChartDimensionsEnum.chDimXValues,(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, arrX);
cht.SeriesCollection[0].SetData(OWC10.ChartDimensionsEnum.chDimYValues,(int)OWC10.ChartSpecialDataSourcesEnum.chDataLiteral, arrY);
cht.SeriesCollection[0].Trendlines.Add();
cht.SeriesCollection[0].Trendlines[0].Type =
OWC10.ChartTrendlineTypeEnum.chTrendlineTypePolynomial;
cht.SeriesCollection[0].Trendlines[0].Order = 6;
Response.ContentType = "image/GIF";
Response.BinaryWrite((byte[])cspace.GetPicture("GIF",800, 600));


Best Regards


Alvin Bruney said:
I don't know.
If you can produce a short but complete program that demonstrates the
problem I can take a look. Go here for an idea on how to generate a small,
complete program http://www.yoda.arachsys.com/csharp/complete.html
PD/ I looked at your book, it seems to be very good ( from the chapter
sample ), but, do you konw when it is going to be at Amazon?

Amazon/Barnes and Noble 15th March 2005

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------


Luis D Rojas said:
Thanks, I think i fixed with your information.
Can you tell me whay my chart does not starts in the first value of my set
of values. For example, it starts on Feb 22 2004, but if i set the
Scaling.HasAutominimum to true the chart starts at Jan 22 2004, and same
happens for the max value, why it gives that time frame. I need my chart
to
start on Feb 22 2004. Do you know how to fix this.

PD/ I looked at your book, it seems to be very good ( from the chapter
sample ), but, do you konw when it is going to be at Amazon?

Alvin Bruney said:
That's not a correct enumeration argument that you are passing to the
chAxes
object.
The axes index takes a ChartAxisTypeEnum enumeration. The reason this is
compiling is because the chAxes object accepts an object as a parameter.
I've pointed out in my book that I think this is a sign of a potentially
defective design because it leads to subtle problems like what you see.
Finally, the hasautominimum property that you apply programmatically
determines the lowest value, if 0 is not your minimum value it simply
won't
show up

--
Regards,
Alvin Bruney [Microsoft MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://www.lulu.com/owc
----------------------------------------------------------


Hi,
I´m working with the chart control with C#
I´m using a chChartTypeScatterLineMarkers chart type.
The chart works fine, but i do not know why the first point at chart X
does
not starts at the (0,0) intersection
It starts to draw the line like 3 month away. And the same happens for
the
last point
i´m using Autoscaling property like this
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMaximum = true;
cht.Axes[ OWC10.ChartAxisPositionEnum.chAxisPositionBottom
].Scaling.HasAutoMinimum = true;

Can somebody help me

thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top