Properties saved in .tee files (ActiveX v7.0.1.4)

TeeChart for ActiveX, COM and ASP
Post Reply
SSkov
Newbie
Newbie
Posts: 15
Joined: Thu Nov 23, 2006 12:00 am
Contact:

Properties saved in .tee files (ActiveX v7.0.1.4)

Post by SSkov » Tue Feb 26, 2008 10:41 am

Hi,

using TeeChart ActiveX v7 (7.0.1.4), I am experiencing some unexpected behavior regarding what is exported from the TeeChart to .tee files (binary as well as text format).

We have defined our own custom palette for series colors, and we are applying the colors programmatically by calling both the CSeries::SetColor() and CPen1::SetColor() methods.

Given a chart containing two series, the first series is given an RGB value of 0 (i.e. totally black), while the second series is given an RGB value of 0xFF0000 (i.e. pure red).

When saving the chart to a .tee file, the file does not contain any color information for the first series (the black one). The second series, however, contains colorinformation in the line:

LinePen.Color = clRed


Now, going into the TeeChart configuration dialog, in the Series/Format pane, selecting the second series (the red one), I modify both the Border and Color attributes, giving them the same green color. When exporting the chart, the first series remains without color information, while the second series now has two color information entries:

SeriesColor = 8454016
LinePen.Color = 8454016


First question:

Is it right to assume that setting the "Border" attribute in the TeeChart configuration dialog is equivalent to the CPen1::SetColor() function call, and setting the "Color" attribute is equivalent to the CSeries::SetColor() function call?


Second question:

Is the fact, that the first series (the black) is not saved with color information, a design decision or a bug? In case of the former, is there any way we can force series to always export color information?
Best regards

Steffen Skov
Senior Consultant
SPT Group

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Feb 26, 2008 11:13 am

Hi Steffen,
First question:

Is it right to assume that setting the "Border" attribute in the TeeChart configuration dialog is equivalent to the CPen1::SetColor() function call, and setting the "Color" attribute is equivalent to the CSeries::SetColor() function call?
Yes, that's right.
Second question:

Is the fact, that the first series (the black) is not saved with color information, a design decision or a bug? In case of the former, is there any way we can force series to always export color information?
For the first series only SeriesColor is saved. LinePen color is not saved because black is the defaul color. However, if you modify first series colors you'll see them saved in the .tee file.

A trick for saving border with black color could be setting it to RGB(1,0,0) instead of RGB(0,0,0) (clBlack).
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SSkov
Newbie
Newbie
Posts: 15
Joined: Thu Nov 23, 2006 12:00 am
Contact:

Post by SSkov » Tue Feb 26, 2008 12:44 pm

Hi Narcís,

thank you for your swift reply.

I tested your trick concerning saving the border/pen color, and I do get the LinePen.Color entry in the .tee file for both series now.
For the first series only SeriesColor is saved. LinePen color is not saved because black is the defaul color. However, if you modify first series colors you'll see them saved in the .tee file.
After having looked closer into my code, it seems I have not been completely honest with you, regarding how we set the colors on our series. We are actually applying our custom palette to the chart by calling CTChart::ApplyCustomPalette(). Thus our Series::SetColor() calls are redundant.

Here comes another of my assumptions, which I would like to get confirmed: The reason why I do not get any SeriesColor entries in my .tee file (until I go into the configuration dialog and change the colors), is that by calling ApplyCustomPalette() with the same color entries, which we use in our calls to Series::SetColor(), the TeeChart considers these colors the default ones, and hence, do not save them.


I think I have found a bug in relation to this, though:

When we later load the .tee file (which now has no SeriesColor entries), the TeeChart will want to pick the default color for the series. However, it seems that instead of using the color palette provided by us through ApplyCustomPalette(), it uses its original default palette.

I will try to figure out a way of working around this problem, unless of course you can confirm this is a bug, and that it is (going to be) fixed in a newer version.
Best regards

Steffen Skov
Senior Consultant
SPT Group

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Mar 04, 2008 10:55 am

Hi Steffen,

true, applying custom color palette is not saved into the .tee file. I've added issue on our defect/wish list to be considered for the next releases.
In meantime a workaround would be to save it manually (the colors or the array) when the export is done and reload them when loadFromFile is called.

SSkov
Newbie
Newbie
Posts: 15
Joined: Thu Nov 23, 2006 12:00 am
Contact:

Post by SSkov » Tue Mar 04, 2008 11:46 am

Hi Pep,

thank you for your reply.

The workaround you suggest is exactly what I have implemented. However, while implementing it, it crossed my mind that another workaround might be to temporarily apply the default TeeChart palette before exporting. This way the colors not matching this would be saved nicely to the .tee file, and loaded equally successfully. This alternative would not require any additional data saving, thus possibly requiring less effort to implement.

I have not tested this, as I was almost finished implementing the first workaround. If the TeeChart replaces the actual series colors when applying a palette, this alternative workaround would not work anyway.

Just something for others to try out if anyone else runs into the same situation as me.
Best regards

Steffen Skov
Senior Consultant
SPT Group

Post Reply