Xamarind.Android System.Drawing.Color != Android.Color

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Thomas
Newbie
Newbie
Posts: 15
Joined: Thu Mar 21, 2013 12:00 am

Xamarind.Android System.Drawing.Color != Android.Color

Post by Thomas » Wed Jan 15, 2014 10:58 am

Hi.
For xamarin android teecharts we use System.Drawing.Colors. For native controls we use Android.Graphics.Color.
But with the same argb components they look different. For example #333333 color in System.Drawing.Color on charts is darker than Android.Graphics.Color?
Maybe there is some property in TChart like shadow which can change chart look, but i can't find it. Alpha is set to opaque.
How to make equal colors?
Thanks in advance.

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

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Narcís » Wed Jan 15, 2014 12:47 pm

Hi Thomas,

Where does this occur in TeeChart? By default, some TeeChart pens are automatically slightly darkened for aesthetic purposes.

BTW, you may also be interested in the Steema.TeeChart.Utils.ToAndroidColor(Color r); method that transforms a System.Drawing.Color color to Android.Graphics.Color.

Code: Select all

    /// <summary>
    ///Converts a System.Drawing.Color to Android.Graphics.Color
    /// </summary>
    public static Android.Graphics.Color ToAndroidColor(Color r)
    {
      return new Android.Graphics.Color(r.ToArgb());
    }
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

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

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Narcís » Fri Jan 17, 2014 11:42 am

Hi Thomas,
Narcís wrote:By default, some TeeChart pens are automatically slightly darkened for aesthetic purposes.
You can still eliminate this effect as I suggested here though.
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

Thomas
Newbie
Newbie
Posts: 15
Joined: Thu Mar 21, 2013 12:00 am

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Thomas » Thu Jan 30, 2014 11:52 am

Hi!
It appears in CircularGauge.FaceBrush.Color.
Pen color doesn't help to solve this issue.
Steema.TeeChart.Utils.ToAndroidColor() returns correct color, but it looks darker on the screen.

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

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Narcís » Thu Jan 30, 2014 12:49 pm

Hi Thomas,

Thanks for your reply. Ok, the problem is not about pens but brushes. I created a chart using this code:

Code: Select all

    private Steema.TeeChart.TChart tChart1;

    private void InitializeChart()
    {
      tChart1 = new Steema.TeeChart.TChart(this);
      tChart1.Aspect.View3D = false;

      Steema.TeeChart.Themes.BlackIsBackTheme myTheme = new Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
      myTheme.Apply();
	  
      string hexColor = "#333333";
      ColorConverter converter = new ColorConverter();
      Color c = (Color)converter.ConvertFromString(hexColor);

      Steema.TeeChart.Styles.CircularGauge circularGauge1 = new Steema.TeeChart.Styles.CircularGauge(tChart1.Chart);
      circularGauge1.FaceBrush.Gradient.Visible = false;
      circularGauge1.FaceBrush.Color = c;

      tChart1.Panel.Gradient.Visible = false;
      tChart1.Panel.Color = c;

      SetContentView(tChart1);
    }
Which produced this chart:
device-2014-01-30-133736.png
device-2014-01-30-133736.png (87.46 KiB) Viewed 11396 times
I copied a section of the CircularGauge over the panel to compare colors:
ColorComp.png
ColorComp.png (110.27 KiB) Viewed 11405 times
Honestly, using latest TeeChart for Xamarin.Android build (v4.13.12.13) from December 2013, I can not see any difference between circularGauge1.FaceBrush.Color and tChart1.Panel.Color. This can also be seen in red, for example:
device-2014-01-30-130014.png
device-2014-01-30-130014.png (92.56 KiB) Viewed 11401 times
Can you see any color differences? Can you reproduce the problem with the code I posted? If not, can you please modify my code snippet so that we can reproduce the problem here? Finally, which TeeChart for Xamarin.Android build are you using?

Thanks in advance.
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

Thomas
Newbie
Newbie
Posts: 15
Joined: Thu Mar 21, 2013 12:00 am

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Thomas » Thu Jan 30, 2014 1:11 pm

The difference appearance not between FaceBrush and Panel colors.
It appears between android LinearLayout background color and Chart Panel color.
Sorry for misleading information.

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

Re: Xamarind.Android System.Drawing.Color != Android.Color

Post by Narcís » Thu Jan 30, 2014 2:37 pm

Hi Thomas,

I can not reproduce the problem using the code below either:

Code: Select all

    private Steema.TeeChart.TChart tChart1;

    private void InitializeChart()
    {
      tChart1 = new Steema.TeeChart.TChart(this);

      Steema.TeeChart.Themes.BlackIsBackTheme myTheme = new Steema.TeeChart.Themes.BlackIsBackTheme(tChart1.Chart);
      myTheme.Apply();
	  
      string hexColor = "#333333";
      ColorConverter converter = new ColorConverter();
      Color c = (Color)converter.ConvertFromString(hexColor);
      //c = Color.Red;

      Steema.TeeChart.Styles.CircularGauge circularGauge1 = new Steema.TeeChart.Styles.CircularGauge(tChart1.Chart);
      circularGauge1.FaceBrush.Gradient.Visible = false;
      circularGauge1.FaceBrush.Color = c;

      tChart1.Panel.Gradient.Visible = false;
      tChart1.Panel.Color = c;

      tChart1.Aspect.View3D = false;
      tChart1.Zoom.Style = Steema.TeeChart.ZoomStyles.Classic;

      LinearLayout layout = new LinearLayout(this);
      layout.SetBackgroundColor(Steema.TeeChart.Utils.ToAndroidColor(c));
      layout.AddView(tChart1, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, 400));
      SetContentView(layout);
    }
It produces those screenshots:
device-2014-01-30-153239.png
device-2014-01-30-153239.png (61.47 KiB) Viewed 11388 times
device-2014-01-30-153431.png
device-2014-01-30-153431.png (65.51 KiB) Viewed 11396 times
Does this code work fine at your end? Can you please modify it so that we can reproduce the problem here?

Thanks in advance.
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

Post Reply