TChart Issues
TChart Issues
Hi support,
I'm new to TChart so some of my "issues" may just be due to lack of knowledge! While integrating TChart into our product I have found the following issues. I look forward to any assistance that can be given.
1. When multiple lines (eg. "line 1 \n line2") are added to the Header or Footer as one string the lines are display in reverse order. See example 1.
2. The Header and Footer do not align in the center of a chart when the StringAlignment.Center is used programtically. See example 1.
3. Using Series.Add(x,y) appends a single point (as expected) while Series.Add(x[],y[]) replaces the existing points in the series with the new ones. I do not expect the "Add" method to replace data in a series.
4. While in Visual Studio 2008, if the Chart.Footer.Gradient property is clicked on in the Properties Tab Visual Studio 2008 will crash. This also happens with the Header.gradient and Panel.Gradient and probably more if I cared to check.
5. The Export to Excel does not export a native Excel file format.
6. The Export to Text needs a Chart.Header and Chart.Axes label options to allow the Header and Axis labels to be output to the exported text file. I believe the current Export.data.Text.IncludeHeader is misleading in this regard.
7. If the Chart is not part of a form/window the size of the PDF output has to be set explicitly as shown in the code snipet here
tChart1.Chart.Export.Image.PDF.Width = tChart1.Width;
tChart1.Chart.Export.Image.PDF.Height = tChart1.Height;
8. With Export to Text how does one specify the value text format of the series x and y values?
9. Is there a simple way (eg. setting a world coordinates/limit property) to restrict the scrolling of a chart such that the user can't scroll past the end of the data or some other set point.
10. If the Line.Smoothed property is set to True before the series has been added to a chart an exception is thrown.
11. An additional line series is added to the chart series collection when a line series Smoothed property is set to True. This is confusing and make the usage of TChart more complex. For example, a user scenario with our application may have 10 or more Line series per chart and all of them optionally smoothed. With the currrent TChart smoothed data design our application has to handle 20 Line series when only 10 was added. Only the application code should add or remove a series to/from the series collection. The need for an additional "smoothed data" series by TChart should be hidden from the application code.
Edit: This problem is seen very clearly when an export to text is performed of a chart that has smoothed series. The export file will contain the smoothed and unsmoothed data while the user is only expecting one of the other not both. The chart only displays the smoothed.
12. It appears the smoothed line needs more line segments when it is drawn. Please look at the two attachments "Unsmoothed" and "Smoothed". Our customers expect a more rounded top to the peak. Our previous graph component (our modified NPlot) achieved this very nicely using System.Drawing.DrawCurve.
Edit: I have looked at the TChart source code and the poor smoothing with my test data is due to the limit of 600 smoothed points in the Spline.Fragments property. Although I appreciate the need to set a limit, IMO a limit of 600 is too low. The degree of smoothing is reduced the more original data points there are.
13. The ColorLine.Pen.Style only seems to render a non solid line if the width is set to a value greater than 1. That is, our application needs a fine dotted vertical line on the chart but it seems this is not possible as it renders as a fine (Width=1) solid line or a fatter (Width=2) dotted line. Is this a bug?
14. New Feature. It would be very useful to have a lower and upper limit for movement of a Cursor tool along a series.
Thanks for taking the time to look into my points
regards
Mark
I'm new to TChart so some of my "issues" may just be due to lack of knowledge! While integrating TChart into our product I have found the following issues. I look forward to any assistance that can be given.
1. When multiple lines (eg. "line 1 \n line2") are added to the Header or Footer as one string the lines are display in reverse order. See example 1.
2. The Header and Footer do not align in the center of a chart when the StringAlignment.Center is used programtically. See example 1.
3. Using Series.Add(x,y) appends a single point (as expected) while Series.Add(x[],y[]) replaces the existing points in the series with the new ones. I do not expect the "Add" method to replace data in a series.
4. While in Visual Studio 2008, if the Chart.Footer.Gradient property is clicked on in the Properties Tab Visual Studio 2008 will crash. This also happens with the Header.gradient and Panel.Gradient and probably more if I cared to check.
5. The Export to Excel does not export a native Excel file format.
6. The Export to Text needs a Chart.Header and Chart.Axes label options to allow the Header and Axis labels to be output to the exported text file. I believe the current Export.data.Text.IncludeHeader is misleading in this regard.
7. If the Chart is not part of a form/window the size of the PDF output has to be set explicitly as shown in the code snipet here
tChart1.Chart.Export.Image.PDF.Width = tChart1.Width;
tChart1.Chart.Export.Image.PDF.Height = tChart1.Height;
8. With Export to Text how does one specify the value text format of the series x and y values?
9. Is there a simple way (eg. setting a world coordinates/limit property) to restrict the scrolling of a chart such that the user can't scroll past the end of the data or some other set point.
10. If the Line.Smoothed property is set to True before the series has been added to a chart an exception is thrown.
11. An additional line series is added to the chart series collection when a line series Smoothed property is set to True. This is confusing and make the usage of TChart more complex. For example, a user scenario with our application may have 10 or more Line series per chart and all of them optionally smoothed. With the currrent TChart smoothed data design our application has to handle 20 Line series when only 10 was added. Only the application code should add or remove a series to/from the series collection. The need for an additional "smoothed data" series by TChart should be hidden from the application code.
Edit: This problem is seen very clearly when an export to text is performed of a chart that has smoothed series. The export file will contain the smoothed and unsmoothed data while the user is only expecting one of the other not both. The chart only displays the smoothed.
12. It appears the smoothed line needs more line segments when it is drawn. Please look at the two attachments "Unsmoothed" and "Smoothed". Our customers expect a more rounded top to the peak. Our previous graph component (our modified NPlot) achieved this very nicely using System.Drawing.DrawCurve.
Edit: I have looked at the TChart source code and the poor smoothing with my test data is due to the limit of 600 smoothed points in the Spline.Fragments property. Although I appreciate the need to set a limit, IMO a limit of 600 is too low. The degree of smoothing is reduced the more original data points there are.
13. The ColorLine.Pen.Style only seems to render a non solid line if the width is set to a value greater than 1. That is, our application needs a fine dotted vertical line on the chart but it seems this is not possible as it renders as a fine (Width=1) solid line or a fatter (Width=2) dotted line. Is this a bug?
14. New Feature. It would be very useful to have a lower and upper limit for movement of a Cursor tool along a series.
Thanks for taking the time to look into my points
regards
Mark
- Attachments
-
- example 1.jpg (41.85 KiB) Viewed 12738 times
-
- Unsmoothed.jpg (57.58 KiB) Viewed 12662 times
-
- Smoothed.jpg (48.56 KiB) Viewed 12634 times
Re: TChart Issues
Hello VarMelb,
If you could reproduce the problem using next code, please you could say us what version of TeeChart.Net using?
If you couldn't reproduce the problem using next code, please, modify code because we can reproduce issue here.
I made a simple example that works correctly here. Please, check using next code, that change Width and Height values, works as you want.
I recommend that see TeeChart.Net Demo concretely All Features\Welcome !\Functions\Extended\Smoothing function and look at the property factor. It allow change the smooth of the function as you want.
I think that you can use it, because internally smoothed property of line series use a smoothing function.
On the other hand, I have added it in wish-list with number [TF02014708] to be considered for inclusion in future releases.
I hope will helps.
Thanks,
I could reproduce your problem here using last version of TeeChart.Net. I have added it in bug list report with number [TF02014704]. We will try to fix for next maintenance release.1. When multiple lines (eg. "line 1 \n line2") are added to the Header or Footer as one string the lines are display in reverse order. See example 1.
I couldn't reproduce your problem using last version 4 of TeeChart.Net, please could you say if using next code you can reproduce the problem?2. The Header and Footer do not align in the center of a chart when the StringAlignment.Center is used programtically. See example 1.
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues(10);
line2.FillSampleValues(10);
tChart1.Footer.Visible = true;
tChart1.Footer.Text = "line1\n" + "line2 \n";
tChart1.Footer.Alignment = StringAlignment.Center;
tChart1.Header.Visible = true;
tChart1.Header.Text = "line1\n" + "line2 \n";
tChart1.Header.Alignment = StringAlignment.Center;
}
If you couldn't reproduce the problem using next code, please, modify code because we can reproduce issue here.
If you add arrays but doesn't replace existing points in the series with new ones you needs use method Series.Add(Array XValues,Array YValues,bool append) that adds the X and Y arrays, optionally appending the values to any existing ones.3.Using Series.Add(x,y) appends a single point (as expected) while Series.Add(x[],y[]) replaces the existing points in the series with the new ones. I do not expect the "Add" method to replace data in a series.
I could reproduce your problem here using last version of TeeChart.Net. I have added it in bug list report with number [TF02014705]. We will try to fix for next maintenance release.4.While in Visual Studio 2008, if the Chart.Footer.Gradient property is clicked on in the Properties Tab Visual Studio 2008 will crash. This also happens with the Header.gradient and Panel.Gradient and probably more if I cared to check.
5. The Export to Excel does not export a native Excel file format.
Whether or not to include the Header of the data Series source in the exported data. The Header is typically the Series Title, or, if not set, the Series Name.6. The Export to Text needs a Chart.Header and Chart.Axes label options to allow the Header and Axis labels to be output to the exported text file. I believe the current Export.data.Text.IncludeHeader is misleading in this regard.
7. If the Chart is not part of a form/window the size of the PDF output has to be set explicitly as shown in the code snipet here
tChart1.Chart.Export.Image.PDF.Width = tChart1.Width;
tChart1.Chart.Export.Image.PDF.Height = tChart1.Height;
I made a simple example that works correctly here. Please, check using next code, that change Width and Height values, works as you want.
Code: Select all
private void button4_Click(object sender, EventArgs e)
{
ChartPDF = new Steema.TeeChart.TChart();
ChartPDF.Width = 800;
ChartPDF.Height = 600;
line1 = new Steema.TeeChart.Styles.Line(ChartPDF.Chart);
line2 = new Steema.TeeChart.Styles.Line(ChartPDF.Chart);
line1.FillSampleValues(10);
line2.FillSampleValues(10);
tChart1.Footer.Visible = true;
tChart1.Footer.Text = "line1\n" + "line2 \n";
tChart1.Footer.Alignment = StringAlignment.Near;
tChart1.Header.Visible = true;
tChart1.Header.Text = "line1\n" + "line2 \n";
tChart1.Header.Alignment = StringAlignment.Near;
ChartPDF.Draw();
ChartPDF.Export.Image.PDF.Save("C:\\ChartPDF.pdf");
}
I think you can use propierty ValueFormat as following lines of code:8. With Export to Text how does one specify the value text format of the series x and y values?
Code: Select all
line1.ValueFormat = "0.0e-0";
line2.ValueFormat = "0.0e-0";
You can do something next:9. Is there a simple way (eg. setting a world coordinates/limit property) to restrict the scrolling of a chart such that the user can't scroll past the end of the data or some other set point.
Code: Select all
void tChart1_Scroll(object sender, EventArgs e)
{
if (tChart1.Axes.Bottom.Maximum>line1.MaxXValue() || tChart1.Axes.Bottom.Minimum<0)
{
tChart1.Axes.Bottom.AutomaticMinimum = false;
tChart1.Axes.Bottom.Minimum = 0;
tChart1.Axes.Bottom.AutomaticMaximum = false;
tChart1.Axes.Bottom.Maximum = line1.MaxXValue();
}
}
I could reproduce your problem. I have added it to the bug list [TF02014706] to be fixed for future releases.10. If the Line.Smoothed property is set to True before the series has been added to a chart an exception is thrown.
11 and 12:11. An additional line series is added to the chart series collection when a line series Smoothed property is set to True. This is confusing and make the usage of TChart more complex. For example, a user scenario with our application may have 10 or more Line series per chart and all of them optionally smoothed. With the currrent TChart smoothed data design our application has to handle 20 Line series when only 10 was added. Only the application code should add or remove a series to/from the series collection. The need for an additional "smoothed data" series by TChart should be hidden from the application code.
Edit: This problem is seen very clearly when an export to text is performed of a chart that has smoothed series. The export file will contain the smoothed and unsmoothed data while the user is only expecting one of the other not both. The chart only displays the smoothed.
12. It appears the smoothed line needs more line segments when it is drawn. Please look at the two attachments "Unsmoothed" and "Smoothed". Our customers expect a more rounded top to the peak. Our previous graph component (our modified NPlot) achieved this very nicely using System.Drawing.DrawCurve.
Edit: I have looked at the TChart source code and the poor smoothing with my test data is due to the limit of 600 smoothed points in the Spline.Fragments property. Although I appreciate the need to set a limit, IMO a limit of 600 is too low. The degree of smoothing is reduced the more original data points there are.
I recommend that see TeeChart.Net Demo concretely All Features\Welcome !\Functions\Extended\Smoothing function and look at the property factor. It allow change the smooth of the function as you want.
I think that you can use it, because internally smoothed property of line series use a smoothing function.
Yes, I have added it to list bug report with number [TF02014707]. We will try to fix for next versions of TeeChart.Net13. The ColorLine.Pen.Style only seems to render a non solid line if the width is set to a value greater than 1. That is, our application needs a fine dotted vertical line on the chart but it seems this is not possible as it renders as a fine (Width=1) solid line or a fatter (Width=2) dotted line. Is this a bug?
You can do a similar code I suggested in question 9 with Cursor tool.14. New Feature. It would be very useful to have a lower and upper limit for movement of a Cursor tool along a series.
On the other hand, I have added it in wish-list with number [TF02014708] to be considered for inclusion in future releases.
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hi Sandra,
thanks for the detailed reply. I'm currently using TeeChart.dll version 4.0.2009.62332.
re:
tChart1.Header.Text = "012345678910109876543210";
tChart1.Header.Alignment = StringAlignment.Center;
tChart1.Axes.Bottom.Title.Text = "012345678910109876543210";
re:
re:
re:
Taking a look at the TeeChart source code I find the following.
The property "tChart1.Chart.Export.Data.Text.IncludeSeriesTitle" basically maps to "tChart1.Chart.Chart.Series[0].Title" which is as expected.
The property "tChart1.Chart.Export.Data.Text.IncludeHeader" basically maps to "tChart1.Chart.Series[0].ValuesLists[0].Name" which I do not expect.
The export supports these properties:
tChart1.Chart.Chart.Series[0].Title
tChart1.Chart.Series[0].ValuesLists[0].Name
What I need is export to support the following properties as well:
tChart1.Chart.Axes.Left.Title
tChart1.Chart.Axes.Bottom.Title
tChart1.Chart.Header
re: 7.
re:
Looking at the TeeChart source code I found the following:
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString();"
I believe it needs to be as follows
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString(aSeries.ValueFormat);"
re:
re:
My main points are as follows.
TeeChart adds an extra series for each original series that is smoothed. This is more difficult for application code to handle.
The number of points in the smoothed series is limited to 600. If I have 6 data points the maximum smoothing factor is 100, 60 points allows for a max factor of 10 and 600 points a max factor of 1.
Given TeeChart's smoothing is achieved by drawing more line segments (using 'LineTo' rather than using 'DrawCurve') the more points present in the original data series the less smoothed the smoothed series will be.
As it is now the Smoothed series is not much use to me. What options do I have for custom drawing of a series points?
re:
Again thankyou for your time looking at my issues.
regards
Mark
thanks for the detailed reply. I'm currently using TeeChart.dll version 4.0.2009.62332.
re:
You need to use longer text. I have only set the Header and XAxis to Center. Please see "header not centered.jpg". I have resized the chart window to show the difference more clearly.2. The Header and Footer do not align in the center of a chart when the StringAlignment.Center is used programtically. See example 1.
tChart1.Header.Text = "012345678910109876543210";
tChart1.Header.Alignment = StringAlignment.Center;
tChart1.Axes.Bottom.Title.Text = "012345678910109876543210";
re:
Yes, I'm aware of the overload my point is an "Add" method should only add not replace. At the very least the default of Add(x[],y[], append) should be to add! Anyway I've made my point.3.Using Series.Add(x,y) appends a single point (as expected) while Series.Add(x[],y[]) replaces the existing points in the series with the new ones. I do not expect the "Add" method to replace data in a series.
re:
No comment?5. The Export to Excel does not export a native Excel file format.
re:
You say that "The Header is typically the Series Title..." yet the code says otherwise! There is no Header property on the Series.6. The Export to Text needs a Chart.Header and Chart.Axes label options to allow the Header and Axis labels to be output to the exported text file. I believe the current Export.data.Text.IncludeHeader is misleading in this regard.
Whether or not to include the Header of the data Series source in the exported data. The Header is typically the Series Title, or, if not set, the Series Name.
Taking a look at the TeeChart source code I find the following.
The property "tChart1.Chart.Export.Data.Text.IncludeSeriesTitle" basically maps to "tChart1.Chart.Chart.Series[0].Title" which is as expected.
The property "tChart1.Chart.Export.Data.Text.IncludeHeader" basically maps to "tChart1.Chart.Series[0].ValuesLists[0].Name" which I do not expect.
The export supports these properties:
tChart1.Chart.Chart.Series[0].Title
tChart1.Chart.Series[0].ValuesLists[0].Name
What I need is export to support the following properties as well:
tChart1.Chart.Axes.Left.Title
tChart1.Chart.Axes.Bottom.Title
tChart1.Chart.Header
re: 7.
I left out "ChartPDF.Draw();", thankyou.If the Chart is not part of a form/window the size of the PDF output has to be set explicitly as shown in the code snipet here
tChart1.Chart.Export.Image.PDF.Width = tChart1.Width;
tChart1.Chart.Export.Image.PDF.Height = tChart1.Height;
re:
This property does not have the desired effect.8. With Export to Text how does one specify the value text format of the series x and y values?
I think you can use propierty ValueFormat as following lines of code:
Looking at the TeeChart source code I found the following:
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString();"
I believe it needs to be as follows
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString(aSeries.ValueFormat);"
re:
Thankyou, i will try your suggestion.9. Is there a simple way (eg. setting a world coordinates/limit property) to restrict the scrolling of a chart such that the user can't scroll past the end of the data or some other set point.
re:
I have looked at the demo, the demo code and the TeeChart source code. I believe I have a reasonable idea of what is happening. Please read my original 11 & 12 post carefully.11 and 12:
I recommend that see TeeChart.Net Demo concretely All Features\Welcome !\Functions\Extended\Smoothing function and look at the property factor. It allow change the smooth of the function as you want.
I think that you can use it, because internally smoothed property of line series use a smoothing function.
My main points are as follows.
TeeChart adds an extra series for each original series that is smoothed. This is more difficult for application code to handle.
The number of points in the smoothed series is limited to 600. If I have 6 data points the maximum smoothing factor is 100, 60 points allows for a max factor of 10 and 600 points a max factor of 1.
Given TeeChart's smoothing is achieved by drawing more line segments (using 'LineTo' rather than using 'DrawCurve') the more points present in the original data series the less smoothed the smoothed series will be.
As it is now the Smoothed series is not much use to me. What options do I have for custom drawing of a series points?
re:
This will not give the desired result. The cursor movement has to be restricted within the data series while still displaying all of the data series. The only way I have got this to work is to toggle the FollowMouse property from a OnMouseMove event. This is not ideal as we want the user to click on the cursor to drag it. I hope this new feature can be added in the next release.14. New Feature. It would be very useful to have a lower and upper limit for movement of a Cursor tool along a series.
You can do a similar code I suggested in question 9 with Cursor tool.
On the other hand, I have added it in wish-list with number [TF02014708] to be considered for inclusion in future releases.
Again thankyou for your time looking at my issues.
regards
Mark
- Attachments
-
- header not centered.jpg (28.7 KiB) Viewed 12557 times
Re: TChart Issues
Hello
I couldn't reproduce your problem, because when I export Excel format. Please you could say us what do you mean by that are not exported as native Excel files?
Thanks,
tChart1.Header.Alignment behaves as expected according to the design because calculate the alignment respect to all the chart unlike tChart1.Axes.Bottom.Title.Text, that calculate alignment respect BottomAxis, why the position is different.You need to use longer text. I have only set the Header and XAxis to Center. Please see "header not centered.jpg". I have resized the chart window to show the difference more clearly.
tChart1.Header.Text = "012345678910109876543210";
tChart1.Header.Alignment = StringAlignment.Center;
tChart1.Axes.Bottom.Title.Text = "012345678910109876543210";
I apologize, I'm going to forget to reply the question. I am sorry.5. The Export to Excel does not export a native Excel file format.
I couldn't reproduce your problem, because when I export Excel format. Please you could say us what do you mean by that are not exported as native Excel files?
tChart1.Export.Data.Text.IncludeHeader behaves as expected according to the design put a header for each column of values. But, I have added your suggestion to list of feature request with number [TF02014711] to be considered for inclusion in future releases.Taking a look at the TeeChart source code I find the following.
The property "tChart1.Chart.Export.Data.Text.IncludeSeriesTitle" basically maps to "tChart1.Chart.Chart.Series[0].Title" which is as expected.
The property "tChart1.Chart.Export.Data.Text.IncludeHeader" basically maps to "tChart1.Chart.Series[0].ValuesLists[0].Name" which I do not expect.
I couldn't reproduce your issue. Please, you could send us a simple project because we can reproduce exactly your problem here?This property does not have the desired effect.
Looking at the TeeChart source code I found the following:
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString();"
I believe it needs to be as follows
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString(aSeries.ValueFormat);"
I have added your suggestion to wish-list with number [TF02014713] to be considered for inclusion in future releases.TeeChart adds an extra series for each original series that is smoothed. This is more difficult for application code to handle.
I could reproduce it and I have added your suggestion to list of feature request with number [TF02014712] to be considered for inclusion in future releases.It appears the smoothed line needs more line segments when it is drawn. Please look at the two attachments "Unsmoothed" and "Smoothed". Our customers expect a more rounded top to the peak. Our previous graph component (our modified NPlot) achieved this very nicely using System.Drawing.DrawCurve.
Edit: I have looked at the TChart source code and the poor smoothing with my test data is due to the limit of 600 smoothed points in the Spline.Fragments property. Although I appreciate the need to set a limit, IMO a limit of 600 is too low. The degree of smoothing is reduced the more original data points there are.
I propose that can make your custom series deriving from an existing series and do override or other methods of DrawValue. There are examples in this link.As it is now the Smoothed series is not much use to me. What options do I have for custom drawing of a series points?
I am not explained correctly sorry. I wanted to refer that you could do something similar with point 9, but changing scroll event for example: Change cursor Event. I recommend see demo examples concretely All Features\Welcome !\Tools\Cursor that I think, you can help.14. New Feature. It would be very useful to have a lower and upper limit for movement of a Cursor tool along a series.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hi Sandra,
thankyou for your replies.
You say you can't reproduce my problem so which property (or method) do you use to export a series value of (for example) 123.45678 to a text file as "123.46"?
I have looked at the method "private void DoSeries(int index, Styles.Series aSeries, ref int tmpNum, ref string tmpResult)" in Export.cs in the TeeChart2005.sln. All the ValueList conversions just use "ToString()" when I change them to be "ToString(aSeries.ValueFormat)" and rebuild TeeChart the export now works as expected.
void tChart1_AfterDraw(object sender, Graphics3D g)
{
if (smoothedSeries.Count > 0)
{
foreach (Series series in smoothedSeries)
{
Pen pen = new Pen(series.Color);
GraphicsPath path = new GraphicsPath();
Point[] points = new Point[series.Count];
for (int i = 0; i < series.Count; i++)
{
points.X = series.CalcXPos(i);
points.Y = series.CalcYPos(i);
}
path.AddCurve(points, 0.35F);
g.SetClipRegion(new Region(series.Chart.ChartRect));
g.DrawPath(pen, path);
g.ClearClipRegions();
}
}
}
Please have a look at the attachment "new smoothed.jpg" and compare it with the attachments I posted in a previous post.
However, I have two problems.
The first problem, is to do with PDF export. Please see the attachment "new smoothed pdf output.jpg" only the values from the series are displayed - no smoothed curve.
Now the problem here is that the DrawPath method in CanvasPDF.cs (in TeeChart2005.sln) is implemented as follows.
public override void DrawPath(Pen pen, GraphicsPath path) { }
Clearly, this feature has not been implemented for PDF. Please add this to your defect tracking system.
The second problem I have is that I can't stop the non smooth data from be drawn on the chart canvas. I will look at overriding the Draw() method. Do you have any suggestions that might help me?
Edit (later):
Ok I have solved the problem of preventing the non smoothed data from being drawn with the following code:
internal class MyGraphLine : Line
{
private bool smoothed;
public override void Draw()
{
if (smoothed)
DrawSmooth();
else
base.Draw();
}
public new bool Smoothed
{
get { return smoothed; }
set { smoothed = value; }
}
private void DrawSmooth()
{
Pen pen = new Pen(Color);
GraphicsPath path = new GraphicsPath();
Point[] points = new Point[Count];
for (int i = 0; i < Count; i++)
{
points.X = CalcXPos(i);
points.Y = CalcYPos(i);
}
path.AddCurve(points, 0.35F);
Chart.Graphics3D.SetClipRegion(new Region(Chart.ChartRect));
Chart.Graphics3D.DrawPath(pen, path);
Chart.Graphics3D.ClearClipRegions();
}
}
This is a cleaner solution to the problem.
However, I still have the problem with exporting the chart to PDF. That is there is now no line drawn on the chart.
thankyou for taking the time to look at my issues.
regards
Mark
thankyou for your replies.
Yes, I could see the alignment was on the chart canvas the problem we have for our customers is that the window background is the same color as the chart background so the only real point of reference is the chart itself. And as the legend is not displayed the title looks off center. What options do we have or do we have to live with Steema's design decision?You need to use longer text. I have only set the Header and XAxis to Center. Please see "header not centered.jpg". I have resized the chart window to show the difference more clearly.
tChart1.Header.Text = "012345678910109876543210";
tChart1.Header.Alignment = StringAlignment.Center;
tChart1.Axes.Bottom.Title.Text = "012345678910109876543210";
tChart1.Header.Alignment behaves as expected according to the design because calculate the alignment respect to all the chart unlike tChart1.Axes.Bottom.Title.Text, that calculate alignment respect BottomAxis, why the position is different.
That's ok. When I say "native Excel files" I mean the file format that is saved from Excel when you select save to Excel format. This is not a problem for us as we will not use this feature. However, I will say that the export to Excel is misleading as it looks to be simply exporting to HTML. From my point of view you may consider this issue closed.5. The Export to Excel does not export a native Excel file format.
I apologize, I'm going to forget to reply the question. I am sorry.
I couldn't reproduce your problem, because when I export Excel format. Please you could say us what do you mean by that are not exported as native Excel files?
First, let me see if my understanding is correct. Am I correct in using the property Series.ValueFormat to determine the data format when exporting series values to text?This property does not have the desired effect.
Looking at the TeeChart source code I found the following:
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString();"
I believe it needs to be as follows
"tmpResult += TextDelimiter + aSeries.valuesList[tt][index].ToString(aSeries.ValueFormat);"
I couldn't reproduce your issue. Please, you could send us a simple project because we can reproduce exactly your problem here?
You say you can't reproduce my problem so which property (or method) do you use to export a series value of (for example) 123.45678 to a text file as "123.46"?
I have looked at the method "private void DoSeries(int index, Styles.Series aSeries, ref int tmpNum, ref string tmpResult)" in Export.cs in the TeeChart2005.sln. All the ValueList conversions just use "ToString()" when I change them to be "ToString(aSeries.ValueFormat)" and rebuild TeeChart the export now works as expected.
I have found the following work around (in part!).As it is now the Smoothed series is not much use to me. What options do I have for custom drawing of a series points?
I propose that can make your custom series deriving from an existing series and do override or other methods of DrawValue. There are examples in this link.
void tChart1_AfterDraw(object sender, Graphics3D g)
{
if (smoothedSeries.Count > 0)
{
foreach (Series series in smoothedSeries)
{
Pen pen = new Pen(series.Color);
GraphicsPath path = new GraphicsPath();
Point[] points = new Point[series.Count];
for (int i = 0; i < series.Count; i++)
{
points.X = series.CalcXPos(i);
points.Y = series.CalcYPos(i);
}
path.AddCurve(points, 0.35F);
g.SetClipRegion(new Region(series.Chart.ChartRect));
g.DrawPath(pen, path);
g.ClearClipRegions();
}
}
}
Please have a look at the attachment "new smoothed.jpg" and compare it with the attachments I posted in a previous post.
However, I have two problems.
The first problem, is to do with PDF export. Please see the attachment "new smoothed pdf output.jpg" only the values from the series are displayed - no smoothed curve.
Now the problem here is that the DrawPath method in CanvasPDF.cs (in TeeChart2005.sln) is implemented as follows.
public override void DrawPath(Pen pen, GraphicsPath path) { }
Clearly, this feature has not been implemented for PDF. Please add this to your defect tracking system.
The second problem I have is that I can't stop the non smooth data from be drawn on the chart canvas. I will look at overriding the Draw() method. Do you have any suggestions that might help me?
Edit (later):
Ok I have solved the problem of preventing the non smoothed data from being drawn with the following code:
internal class MyGraphLine : Line
{
private bool smoothed;
public override void Draw()
{
if (smoothed)
DrawSmooth();
else
base.Draw();
}
public new bool Smoothed
{
get { return smoothed; }
set { smoothed = value; }
}
private void DrawSmooth()
{
Pen pen = new Pen(Color);
GraphicsPath path = new GraphicsPath();
Point[] points = new Point[Count];
for (int i = 0; i < Count; i++)
{
points.X = CalcXPos(i);
points.Y = CalcYPos(i);
}
path.AddCurve(points, 0.35F);
Chart.Graphics3D.SetClipRegion(new Region(Chart.ChartRect));
Chart.Graphics3D.DrawPath(pen, path);
Chart.Graphics3D.ClearClipRegions();
}
}
This is a cleaner solution to the problem.
However, I still have the problem with exporting the chart to PDF. That is there is now no line drawn on the chart.
thankyou for taking the time to look at my issues.
regards
Mark
- Attachments
-
- new smoothed pdf output.jpg (51.67 KiB) Viewed 12515 times
-
- new smoothed.jpg (69.35 KiB) Viewed 12503 times
Re: TChart Issues
Hello VarMelb,
I think that a way for solve your problem would be add the header position values manually, using method tChart1.Header.CustomPostion= true; and calculate it position (Left,Right,Bottom,Top).Yes, I could see the alignment was on the chart canvas the problem we have for our customers is that the window background is the same color as the chart background so the only real point of reference is the chart itself. And as the legend is not displayed the title looks off center. What options do we have or do we have to live with Steema's design decision?
Yes, you understand correctly .First, let me see if my understanding is correct. Am I correct in using the property Series.ValueFormat to determine the data format when exporting series values to text?
Thanks, now, we can reproduce your problem value format not change correctly. I have added to wish-list with number [TF02014725] to be considerate inclusion it in future next versions.You say you can't reproduce my problem so which property (or method) do you use to export a series value of (for example) 123.45678 to a text file as "123.46"?
Thanks, for your code I could see your problem and I considerate to add in wish-list with number [TF02014721] to be considered inclusion it for next versions of TeeChart. Net.Now the problem here is that the DrawPath method in CanvasPDF.cs (in TeeChart2005.sln) is implemented as follows.
public override void DrawPath(Pen pen, GraphicsPath path) { }
Clearly, this feature has not been implemented for PDF. Please add this to your defect tracking system.
I could reproduce it problem and I have added too list bug report with number [TF02014722]. We will try to fix it for next versions of TeeChart.Net.However, I still have the problem with exporting the chart to PDF. That is there is now no line drawn on the chart.
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hi Sandara,
I would consider the "ValueFormat" issue as a defect and not a wish-list item. However, how you classify it is not that important as long as TeeChart supports the feature asap!
I do hope that Steema can release a mantenance release of TeeChart for .Net V 4.0 asap as some of the issues I have raised are very annoying to our customers.
thanks and regards
Mark
Thanks, that is a good suggestion and I will use it.I think that a way for solve your problem would be add the header position values manually, using method tChart1.Header.CustomPostion= true; and calculate it position (Left,Right,Bottom,Top).
I would consider the "ValueFormat" issue as a defect and not a wish-list item. However, how you classify it is not that important as long as TeeChart supports the feature asap!
I do hope that Steema can release a mantenance release of TeeChart for .Net V 4.0 asap as some of the issues I have raised are very annoying to our customers.
thanks and regards
Mark
Re: TChart Issues
Hello Mark,
Thanks,
Name we give to items it doesn’t matter, because wish-list it is same for all them. I have change priority, item with number (TF02014725), for a higher.I would consider the "ValueFormat" issue as a defect and not a wish-list item. However, how you classify it is not that important as long as TeeChart supports the feature asap!
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hello Marks,
Please see next code and check if works as you want.
I hope will helps.
Thanks,
I must communicate, that bug with number (TF02014707) is not a bug. Basically, the problem, of are not seeing differences of the ColorLine.Pen.Style.X when Width=1, is because Chart is by default SmoothingMode.HighQuality, but if it is changed SmoothinMode, the ColorLine.Pen.Style.X works well. Please see next code and check if works if you want.13. The ColorLine.Pen.Style only seems to render a non solid line if the width is set to a value greater than 1. That is, our application needs a fine dotted vertical line on the chart but it seems this is not possible as it renders as a fine (Width=1) solid line or a fatter (Width=2) dotted line. Is this a bug?
Please see next code and check if works as you want.
Code: Select all
Steema.TeeChart.Styles.Line line1, line2;
Steema.TeeChart.Tools.ColorLine colorline1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
line1 = new Steema.TeeChart.Styles.Line();
line2 = new Steema.TeeChart.Styles.Line();
//-----Problem occurs for next----//
tChart1.Graphics3D.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
//--------Solve problem for next-----//
//tChart1.Graphics3D.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
line1.FillSampleValues(10);
line2.FillSampleValues(10);
tChart1.Series.Add(line2);
colorline1 = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
colorline1.Axis = tChart1.Axes.Bottom;
colorline1.Pen.Style = System.Drawing.Drawing2D.DashStyle.Dot;
colorline1.Pen.Color = Color.OrangeRed;
colorline1.DragRepaint = true;
colorline1.Pen.Width = 1;
tChart1.Footer.Visible = true;
tChart1.Footer.Text = "line1\n" + "line2 \n";
tChart1.Footer.Alignment = StringAlignment.Center;
tChart1.Header.Visible = true;
tChart1.Header.Text = "line1\n" + "line2 \n";
tChart1.Header.Alignment = StringAlignment.Center;
}
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hi Sandra,
thanks for the reply and sorry for the delay in my reply.
I do hope the smoothing can be made "smarter" or at least don't smooth ColorLines.
regards
Mark
thanks for the reply and sorry for the delay in my reply.
Well I don't agree and what you described sounds more like a work around to me. Basically, what you are saying is that certain Pen styles are not compatible with some of the SmoothingModes. If the smoothing can't be made to work better and the incompatibilities do indeed exist then don't applying smoothing to a line when there is a conflict. I would think it is better to ignore the smoothing mode rather than the Pen style. In my case of a vertical ColorLine why is it being smoothed anyway?I must communicate, that bug with number (TF02014707) is not a bug. Basically, the problem, of are not seeing differences of the ColorLine.Pen.Style.X when Width=1, is because Chart is by default SmoothingMode.HighQuality, but if it is changed SmoothinMode, the ColorLine.Pen.Style.X works well. Please see next code and check if works if you want.
I do hope the smoothing can be made "smarter" or at least don't smooth ColorLines.
regards
Mark
Re: TChart Issues
Hello Mark,
Thanks,
I'm afraid we can't consider this as a TeeChart related issue because it also occurs without using TeeChart.So we have considered it as a VS2008 problem. Please, see the attached project that uses a UserControl,without using any TeeChart component, and draws a line directly to canvas. Check that the problem occurs too, and the only solution is changing SmoothModes properties.Well I don't agree and what you described sounds more like a work around to me. Basically, what you are saying is that certain Pen styles are not compatible with some of the SmoothingModes. If the smoothing can't be made to work better and the incompatibilities do indeed exist then don't applying smoothing to a line when there is a conflict. I would think it is better to ignore the smoothing mode rather than the Pen style. In my case of a vertical ColorLine why is it being smoothed anyway?
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: TChart Issues
Hi Sandra,
thanks for the update. I have a work around for our use with the following code:
colorLine.Pen.Style = DashStyle.Custom;
colorLine.Pen.DashPattern = new float[]{1.5F, 1.5F};
I do wonder why the ColorLine has to be smoothed if it temporarily is set to none while the vertical or horizontal line is drawn.
Anyway your reply and example code enabled me to achieve a reasonable work around.
regards
Mark
thanks for the update. I have a work around for our use with the following code:
colorLine.Pen.Style = DashStyle.Custom;
colorLine.Pen.DashPattern = new float[]{1.5F, 1.5F};
I do wonder why the ColorLine has to be smoothed if it temporarily is set to none while the vertical or horizontal line is drawn.
Anyway your reply and example code enabled me to achieve a reasonable work around.
regards
Mark
Re: TChart Issues
Hello Mark,
Ok. We are glad that you found a solution of your problem. It may be useful for other users.
Thanks,
Ok. We are glad that you found a solution of your problem. It may be useful for other users.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |