Page 1 of 1

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

Posted: Wed Jan 15, 2014 10:58 am
by 17365504
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.

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

Posted: Wed Jan 15, 2014 12:47 pm
by narcis
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());
    }

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

Posted: Fri Jan 17, 2014 11:42 am
by narcis
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.

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

Posted: Thu Jan 30, 2014 11:52 am
by 17365504
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.

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

Posted: Thu Jan 30, 2014 12:49 pm
by narcis
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 11397 times
I copied a section of the CircularGauge over the panel to compare colors:
ColorComp.png
ColorComp.png (110.27 KiB) Viewed 11406 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 11402 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.

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

Posted: Thu Jan 30, 2014 1:11 pm
by 17365504
The difference appearance not between FaceBrush and Panel colors.
It appears between android LinearLayout background color and Chart Panel color.
Sorry for misleading information.

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

Posted: Thu Jan 30, 2014 2:37 pm
by narcis
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 11389 times
device-2014-01-30-153431.png
device-2014-01-30-153431.png (65.51 KiB) Viewed 11397 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.