Hi,
my last cry for help was not heared by STEEMA (reference to http://www.teechart.net/support/viewtop ... =4&t=11247).
So I explain it it again:
[*]The previous TeeChart release was useless for me due to bug [TF02014877]
[*]The actual TeeChart release is useless for me if I can not draw custom legend items: The bug discussed in the link above makes it impossible. As mentioned in my last message but ignored by STEEMA the suggested workarounds do not work.
[*]My application is a new tool. I'm ready to use it since several weeks but the bugs make it impossible. And of course, others can not use it, too. And it's very important for us to start with!
I don't think that this situation is acceptable.
So my question is :
Please provide an assembly which is suitable for drawing custom legend items (meaning one must have access to all important dimensions). In the current release there was another essential bug disqualifying TeeChart from real world use. Here you helped with an assembly whith bug fix. Why not here?
Or:
Please provide a working (that means tested in real world with real series under certain manipulations with legend, chart size, legend size...) workaround.
Or:
Please provide the required methods to draw legend symbols (points for 2D graphics would enough) by myself in order to create my own legend with symbols identical to those used by the series.
I'm highly frustrated!
Best regards
Uli
Bug in Legend
Re: Bug in Legend
Hello Uli,
Re.
Re.
Re.
Re.
We will followup to this thread with a list of our current understanding of outstanding issues.
Regards,
Marc Meumann
Re.
Issues relating to this thread are being investigated. The problem relating to 'ghost text' is difficult to resolve as the NET framework does not offer homogenous file-save/save-to-clipboard techniques for metafile (native save would give a png file, see: http://msdn2.microsoft.com/en-us/librar ... afile.aspx). We are using the same set of steps in TeeChart code for file save (that hides ghost text) and clipboard (that doesn't) but the result is different. The cause of this could take some time to find. It is not clear to me from the other thread whether you now have an acceptable workaround technique but if not, and if you require immediate resolution of this issue and wish to export metafile to clipboard, I recommend that you make a temporary list of texts before export, empty actual texts, export and return temp texts.my last cry for help was not heared by STEEMA (reference to http://www.teechart.net/support/viewtop ... =4&t=11247).
Code: Select all
tChart1.Export.Image.Metafile.Save(@"c:\tmp\MyMetachart.emf"); //file ok
String[] tmpLegendTexts = new String[tChart1.Legend.Items.Count];
//clear text list for clipboard copy
for (int i = 0; i < tChart1.Legend.Items.Count; i++ )
{
tmpLegendTexts[i] = tChart1.Legend.Items[i].Text;
tChart1.Legend.Items[i].Text = " "; //could set spaces to length of orig text
}
tChart1.Export.Image.Metafile.CopyToClipboard();
for (int i = 0; i < tChart1.Legend.Items.Count; i++)
{
tChart1.Legend.Items[i].Text = tmpLegendTexts[i];
}
We're checking on status of logged issues related to previous conversations. Please confirm the priority issues you have outstanding.[*]The actual TeeChart release is useless for me if I can not draw custom legend items
Re.
We'll work to resolve outstanding issues for the next maintenance release.Please provide an assembly which is suitable for drawing custom legend items
Re.
Assuming "tChart1.Legend.Visible = false;" the following will draw you a simple Legend:Please provide the required methods to draw legend symbols (points for 2D graphics would enough) by myself
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
g.Font.Size = 12;
int maxTextWidth = (int)(g.TextWidth(tChart1[0].YValues.Maximum.ToString("#0.00")));
int legendMargin = 10;
g.TextAlign = StringAlignment.Far; //note startX when 'Far' will define right side
int startX = tChart1.Axes.Bottom.CalcPosValue(tChart1.Axes.Bottom.Maximum) - legendMargin;
int startY = tChart1.Axes.Left.CalcPosValue(tChart1.Axes.Left.Maximum) + legendMargin;
double lineHeight = g.TextHeight("W") + 2;
int boxSize = 6;
for (int i = 0; i < tChart1[0].Count; i++)
{
g.TextOut(startX, (int)(startY + (lineHeight*i)), tChart1[0].YValues[i].ToString("#0.00"));
g.Brush.Color = tChart1[0].Color;
g.Rectangle(startX - maxTextWidth - 10, (int)(startY + (lineHeight * i) + (lineHeight / 2) - (boxSize/2)), startX - maxTextWidth - 10 + boxSize,
(int)(startY + (lineHeight * i) + (lineHeight / 2) + (boxSize / 2)));
}
g.Brush.Transparency = 100;
g.Rectangle(startX - maxTextWidth - boxSize - 8, startY,
startX + 2,
(int)((tChart1[0].Count*lineHeight) + startY));
}
Regards,
Marc Meumann
Steema Support
Re: Bug in Legend
Hello Uli,
I gives you a list with your bugs, because you can do a tracking of their state:
Thanks,
I gives you a list with your bugs, because you can do a tracking of their state:
- ·TF02015034(open)
·TF02015032(open)
·TF02014990(open)
·TF02014992(open)
·TF02015024 feature request (open)
·TF02015026 enhancement (open)
·TF02014960 feature request (open)
·TF02014988 (On Hold)
·TF02015005(fixed)//next maintenance release
·TF02014878(fixed)//next maintenance release
·TF02014990(fixed)//next maintenance release
·TF02014933(not a bug)
·TF02014877(fixed)// 18th June 2010 maintenance release
·TF02014913(not a bug)
·TF02014922(fixed)// 18th June 2010 maintenance release
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
for(int i=0; i<5; i++)
{
new Steema.TeeChart.Styles.Line(tChart1.Chart);
tChart1[i].Title = tChart1[i].ToString();
tChart1[i].FillSampleValues();
}
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = 30;
tChart1.Legend.Top = 100;
tChart1.Legend.Font.Color = Color.Transparent;
tChart1.Export.Template.Save(@"teeChart.ten");
tChart1.Draw();
tChart2.Import.Template.Load(@"teeChart.ten");
}
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: Bug in Legend
Hi Marc,
thanks for the answer.
First of all, I need a custom legend in order to draw rich text format strings. This was already solved on the basis of the previous release. There I have used the normal legend items position to draw the rich text, the normal legend items font was set to transparent color. In the last release the "normal" legend items left and top properties were not more available (values were always = 0). Then this metafile export behavior came to my attention. Possibly it was there in the former release, too, but real work I tried to start only with the new one.
With the workaround by Christopher
legend items properties were accessible again (after loading twice the chart if I recall it correctly). Since the chart does not draw the items text the metafile export issue was gone, too. But the legend size was now calculated only for the symbol size. So the complete internal routines for calculeting legend size, step height and so on are not more appropriate for the legend I want to draw. Some really strange effects occured during my time consuming attempts.
The legende issue is essential:
If you can provide a way were I can control by code (in the BeforeDraw event, the chart has then to draw on the basis of these values) the following properties (on the basis of Christophers workaround):
[*]Horizontal distance between legend margin and symbol
[*]Vertical distance between symbols (use of Chart.Legend.Items(0).SymbolRectangle did not work sufficently)
[*]Vertical distance between first an last symbol and legend margin
[*]Setting legend height and width and symboltotextgap must work as expected, of course
[*]all settings must work independent of chart dimensions, even if legend is bigger in one dimensions
If this is possible: then I assume the problem is solved.
An alternative solution is to draw my own legend as mentioned in my initial message, but your code example is not sufficient. It's simple to draw a rectangle. But the end users have access to the series editor and so they can decide to draw other symbols as well. The appearance of the symbols must be identical compared with these in the series, including margin and whatever else. So I would need the exact functions to draw the desired symbol (size and possibly other properties) at the position calculated. As said, 2D functions will be sufficient. It would be helpful to get an empty legend without items and symbols in order to easily apply background effects and so on.
Best regards
Uli
thanks for the answer.
First of all, I need a custom legend in order to draw rich text format strings. This was already solved on the basis of the previous release. There I have used the normal legend items position to draw the rich text, the normal legend items font was set to transparent color. In the last release the "normal" legend items left and top properties were not more available (values were always = 0). Then this metafile export behavior came to my attention. Possibly it was there in the former release, too, but real work I tried to start only with the new one.
With the workaround by Christopher
Code: Select all
chart.legend.items.custom = true
That's not an option for me: It's indetermined, when it comes. I must work!!! I really think about alternatives when not comes a solution in nearest future! In another case Narcis provided an "intermediate" release solving an axis scaling bug before the next maintenance release. So this might be possible for this issue, too.We're checking on status of logged issues related to previous conversations. Please confirm the priority issues you have outstanding.
If you have read others of my messages you will have noticed that I have found a lot of bugs . The axis scaling bug (now solved with the "intermediate" release) and this legend issue have highest priority for me. With the other bugs and thereof resulting workarounds I can live a while.We're checking on status of logged issues related to previous conversations. Please confirm the priority issues you have outstanding.
The legende issue is essential:
If you can provide a way were I can control by code (in the BeforeDraw event, the chart has then to draw on the basis of these values) the following properties (on the basis of Christophers workaround):
[*]Horizontal distance between legend margin and symbol
[*]Vertical distance between symbols (use of Chart.Legend.Items(0).SymbolRectangle did not work sufficently)
[*]Vertical distance between first an last symbol and legend margin
[*]Setting legend height and width and symboltotextgap must work as expected, of course
[*]all settings must work independent of chart dimensions, even if legend is bigger in one dimensions
If this is possible: then I assume the problem is solved.
An alternative solution is to draw my own legend as mentioned in my initial message, but your code example is not sufficient. It's simple to draw a rectangle. But the end users have access to the series editor and so they can decide to draw other symbols as well. The appearance of the symbols must be identical compared with these in the series, including margin and whatever else. So I would need the exact functions to draw the desired symbol (size and possibly other properties) at the position calculated. As said, 2D functions will be sufficient. It would be helpful to get an empty legend without items and symbols in order to easily apply background effects and so on.
Best regards
Uli
Re: Bug in Legend
Hello Uli,
First, I have communicated that bug (TF02014988) has been fixed so it should work as expected in the next maintenance release. Also, I have informed you that bug with number (TF02014992) isn't a bug, as such, it is a change of functionality. Below are two workarounds to the problem:
On the other hand,
Also, If you want you could see TeeChart .Net Demo Project, concretely Welcome !\New in Legend\Text-Symbol gap, that it is a more complete example.
Could you please, tell us if previous example works as you want and solves your problem?
I hope will helps.
Thanks,
First, I have communicated that bug (TF02014988) has been fixed so it should work as expected in the next maintenance release. Also, I have informed you that bug with number (TF02014992) isn't a bug, as such, it is a change of functionality. Below are two workarounds to the problem:
Code: Select all
private void InitializeChart()
{
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
lineser = new Steema.TeeChart.Styles.Line(tChart1.Chart);
lineser.FillSampleValues();
lineser2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
lineser2.FillSampleValues();
///*method1*/
tChart1.Draw();
tChart1.Legend.Items.Custom = true;
tChart1.Legend.Items.AutoPosition = true;
/*method2*/
//tChart1.Legend.Items.Custom = true;
//tChart1.Legend.Items.AutoPosition = true;
//tChart1.Legend.Font.Color = Color.Transparent;
//tChart1.Legend.Items.Add(new Steema.TeeChart.LegendItem(tChart1.Legend) { Text = "line1" });
//tChart1.Legend.Items.Add(new Steema.TeeChart.LegendItem(tChart1.Legend) { Text = "line2" });
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
string x = tChart1.Legend.Items[0].Left.ToString();
MessageBox.Show(x);
}
I have suggested you that use properties legend ColumnWidths and ColumnWidthAuto of legend change width of legend items. I think that you can use similar code as next:...So the complete internal routines for calculeting legend size, step height and so on are not more appropriate for the legend I want to draw. Some really strange effects occured during my time consuming attempts.
Code: Select all
private Steema.TeeChart.Styles.Line lineser, lineser2;
private void InitializeChart()
{
lineser = new Steema.TeeChart.Styles.Line(tChart1.Chart);
lineser.FillSampleValues();
lineser2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
lineser2.FillSampleValues();
//clear text list for clipboard copy
this.tChart1.Legend.Items.Custom = true;
this.tChart1.Legend.Items.AutoPosition = true;
this.tChart1.Legend.ColumnWidthAuto = false;
tChart1.Legend.ColumnWidths[1] = 50;
tChart1.Legend.ColumnWidths[0] = 50;
for (int i = 0; i < tChart1.Legend.Items.Count; i++)
{
tChart1.Legend.Items[i].Text = " "; //could set spaces to length of orig text
}
}
Could you please, tell us if previous example works as you want and solves your problem?
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: Bug in Legend
Hello Uli,
Re.
...Steema.TeeChart.Styles.Points points1;
Regards,
Marc
Re.
I think the standard TeeChart Legend, once your questions have been resolved, will be better for your requirements, but just for the record, relating to the afterdraw event legend code, if you wish to plot the Series own Pointer as symbol instead of a rectangle, you would use something like the following, where points1 is a Series having a Pointer (eg. Line, Points or Bubble):An alternative solution is to draw my own legend as mentioned in my initial message, but your code example is not sufficient. It's simple to draw a rectangle. But the end users have access to the series editor and so they can decide to draw other symbols as well.
...Steema.TeeChart.Styles.Points points1;
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (points1 != null)
{
g.Font.Size = 12;
int maxTextWidth = (int)(g.TextWidth(points1.YValues.Maximum.ToString("#0.00")));
int legendMargin = 10;
g.TextAlign = StringAlignment.Far; //note startX when 'Far' will define right side
int startX = tChart1.Axes.Bottom.CalcPosValue(tChart1.Axes.Bottom.Maximum) - legendMargin;
int startY = tChart1.Axes.Left.CalcPosValue(tChart1.Axes.Left.Maximum) + legendMargin;
double lineHeight = g.TextHeight("W") + 2;
g.Brush.Transparency = 0;
for (int i = 0; i < tChart1[0].Count; i++)
{
g.TextOut(startX, (int)(startY + (lineHeight * i)), points1.YValues[i].ToString("#0.00"));
points1.Pointer.Draw(startX - maxTextWidth - 10,
(int)(startY + (lineHeight * i) + (lineHeight / 2) - (points1.Pointer.HorizSize / 2)),
points1.Pointer.Brush.Color);
}
g.Brush.Transparency = 100;
g.Rectangle(startX - maxTextWidth - points1.Pointer.HorizSize - 14, startY,
startX + 2,
(int)((points1.Count * lineHeight) + startY));
}
}
Marc
Steema Support
Re: Bug in Legend
Hi Sandra and Marc,
thanks for the replies.
Sandra,
Marc,
thanks for the code example in order to draw the pointer symbols in a custom legend. Using this the last two days I wrote my own legend, it works fine now. I stiill have to think about some questions concerning serialization and to write the editor.
But I now see the time coming to start with real world use...
Best regards
Uli
thanks for the replies.
Sandra,
I believe I'm missing some...I gives you a list with your bugs, because you can do a tracking of their state:
Can't remember that. On the other sides, I tried out so much different things and experienced so much surprising and not expected behaviour of the legend that I now have decided to code my own one, see below.I have suggested you that use properties legend ColumnWidths and ColumnWidthAuto of legend change width of legend items.
Marc,
thanks for the code example in order to draw the pointer symbols in a custom legend. Using this the last two days I wrote my own legend, it works fine now. I stiill have to think about some questions concerning serialization and to write the editor.
But I now see the time coming to start with real world use...
Best regards
Uli
Re: Bug in Legend
Hello Uli,
Thanks,
Please see Narcís's answers here. Moreover, we continue working to find best solution for remaining bugs.I believe I'm missing some...
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 |