Profile Picture

Series FillColor does not match with Specified FillStyle Color??

Posted By Niranjan Singh 12 Years Ago

Series FillColor does not match with Specified FillStyle Color??

Author
Message
Niranjan Singh
questionmark Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 49, Visits: 179
I have created Series with following fill style as:

chartSeries.FillStyle = new NColorFillStyle(Color.Red);


But,
Color fillColor = (chart.Series[i] as NSeries).FillStyle.GetPrimaryColor().ToColor();


When i compare this with this fillColor == Color.Red. It returns false.

Why these doesn't match, even i have converted return NColor object to Color using it's method ToColor().


Any Help will be appreciated.

Thanks in Advance.


Nevron Support
Posted 12 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Niranjan,

You're comparing a named color with an explicitly specified color. To improve performance nevron controls rarely stroke .NET color instances - instead they simply store ARGB information, without names. The following .NET code also returns false as the name of the second color is "ffff0000":

bool result = (Color.Red == Color.FromArgb(255, 0, 0)); // result is false



Best Regards,
Nevron Support Team



Niranjan Singh
Posted 12 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 4 Years Ago
Posts: 49, Visits: 179
Hi,

Thanks for your reply, i understand that what is going wrong.

Well i have solved this problem as:

Color x = (chart.Series[i] as NSeries).FillStyle.GetPrimaryColor().ToColor();
Color y = NColor.FromString(PreDefinedSeriesColors[i].Name).ToColor();

and comparison of x and y returns true.

Regards,
Niranjan



Similar Topics


Reading This Topic