Page 1 of 1

[Solved] Series lines are black regardless of color set

Posted: Wed Sep 19, 2007 5:29 pm
by 8741243
I am setting a series line color as such:

line.LinePen.Width = 2;
line.LinePen.Color = color;
line.Pointer.Brush.Color = color;
line.Pointer.Pen.Color = color;
line.Color = color;

line is a Styles.Line instance. The issue is that the lines are drawn in black on the chart. They show up in the correct color in the legend, but they are always black on the chart itself. The points show up in the correct color, only the lines themselves are black. Am I not setting a color property somewhere? Have I missed something?

Posted: Thu Sep 20, 2007 9:13 am
by narcis
Hi MattHolmes,

Could you please send us a simple example project we can run "as-is" to reproduce the problem here and let us know which exact TeeChart version are you using?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Thu Sep 20, 2007 3:38 pm
by 8741243
I can try. Pulling this code out of my project is going to be a real pain, but I'll see what I can do.

Posted: Thu Sep 20, 2007 3:51 pm
by narcis
Hi MattHolmes,

Thanks for trying. As you can understand it's pretty difficult for us guessing what the problem can be without being able to reproduce it here. The only think I can think of is that you have a black pen for the lines and display it in 2D but this seems most unlikely as you assing the same color to LinePen. Pointer.Brush and Pointer.Pen. Another thing you can try is setting line.Brush.Color.

Posted: Thu Sep 20, 2007 4:00 pm
by 8741243
I found something odd. I added a BeforeDrawValues event to each of my line series and inspected the values in the LinePen and Brush properties of the line.

When using the color {0, 170, 109}, the Brush.Color and Brush.ForegroundColor inspect correctly, but LinePen.Color has somehow been divided by two, meaning it's color property during the BeforeDrawValues is {0, 85, 54}. Something lowered the intensity of the color. This still doesn't explain why it's drawing as all black, but it is sort of odd and makes me wonder if anything is modifying the colors elsewhere.

Posted: Thu Sep 20, 2007 4:11 pm
by narcis
Hi MattHolmes,

By default and for cosmetic reasons, series's pen colors are set to a color a little bit darker than the specified series color. You'll be able to appreciate that if you have a look at the features demo available at TeeChart's program group. This may be the reason of your colors being "divided by two".

Posted: Thu Sep 20, 2007 4:13 pm
by 8741243
Alright. Well, all the other color values of my lines series are fine during the BeforeDrawValues event. I will try and break out a couple of these series (their points anyway) and put you together a quick app to look at. I am wondering if I am just missing setting elsewhere, like the chart itself.

Posted: Thu Sep 20, 2007 8:42 pm
by 8741243
In the process of creating that small sample, I figured out the issue. Because I am porting legacy C++ code to C#, I was adding points to the series using the Add(double, double, Color) method, because that's how it was done in the old VCL version of this piece of software. The color that was always being used was extremely dark, almost black (black to the naked eye). I changed that to use the Add(PointF) method and the issue went away. Changing the line brush and line pen colors now correctly draws the line in the chart.

Posted: Fri Sep 21, 2007 7:33 am
by narcis
Hi MattHolmes,

I'm glad to hear you solved the problem.