TeeChart.NET v2 Custom Colors

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Walt
Newbie
Newbie
Posts: 35
Joined: Wed Aug 17, 2005 4:00 am
Location: San Jose, CA
Contact:

TeeChart.NET v2 Custom Colors

Post by Walt » Mon Nov 28, 2005 8:18 pm

The following is a continuation of an email thread that was taking place while the forums were down:
____________________________________________


The colors also get reset if you set "ColorEach = true" or even if you don't set it at all.

You just can't see it with the colors you were trying, because your colors are the same as the default random colors. Try some pastel colors. In the code I just sent you, try changing buttonCreate_Click to the following:

Code: Select all

    private void buttonCreate_Click(object sender, System.EventArgs e)
    {
      Bubble bubble1 = CreateBubbleSeries("Bubble 1");
      bubble1.Add(10,10,2,Color.Thistle);
      bubble1.Add(10,20,3,Color.Peru);
      bubble1.Add(20,10,2,Color.PaleTurquoise);
      bubble1.Add(15,15,2,Color.PeachPuff);
      tChart1.Series.Add(bubble1);
    }


Maybe you did fix this in the debug build. I don't have time to try the debug build right now, but hopefully I can tomorrow.

Thanks,

Walt


________________________________________
From: Walt
Sent: Tuesday, November 22, 2005 5:43 PM
To: 'Narcís
Subject: RE: TeeChart.NET v2 Custom Colors

The problem seems to occur when I set "ColorEach" to false. If I don't set it at all, the problem goes away. I was setting ColorEach to false because I didn't want the random colors (but I set the colors myself when adding the bubble points). It was working ok with version 1 of TeeChart.NET, and it appears to be working ok in v2 until I export to ten file and then import it back.

I did not try the debug build, but I suspect that if you add "bubble1.ColorEach = false;" to the code you sent me, you will be able to duplicate the problem.

Here's the exact code I used to duplicate the problem (with all the settings I'm using on the bubble series in my actual app.):

Code: Select all

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
 
using Steema.TeeChart.Styles;
 
namespace TeeChartBubbleColorsTest
{
  /// <summary>
  /// Summary description for Form1.
  /// </summary>
  public class Form1 : System.Windows.Forms.Form
  {
    private Steema.TeeChart.TChart tChart1;
    private System.Windows.Forms.Button buttonCreate;
    private System.Windows.Forms.Button buttonImport;
    private System.Windows.Forms.Button buttonSave;
    private System.Windows.Forms.Button buttonClear;
    private System.Windows.Forms.Button buttonEdit;
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null;
 
    public Form1()
    {
      //
      // Required for Windows Form Designer support
      //
      InitializeComponent();
 
      //
      // TODO: Add any constructor code after InitializeComponent call
      //
    }
 
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
      if( disposing )
      {
        if (components != null) 
        {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }
 
    #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      this.tChart1 = new Steema.TeeChart.TChart();
      this.buttonCreate = new System.Windows.Forms.Button();
      this.buttonImport = new System.Windows.Forms.Button();
      this.buttonSave = new System.Windows.Forms.Button();
      this.buttonClear = new System.Windows.Forms.Button();
      this.buttonEdit = new System.Windows.Forms.Button();
      this.SuspendLayout();
      // 
      // tChart1
      // 
      this.tChart1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
        | System.Windows.Forms.AnchorStyles.Left) 
        | System.Windows.Forms.AnchorStyles.Right)));
      // 
      // tChart1.Header
      // 
      this.tChart1.Header.Lines = new string[] {
                                                 "TeeChart"};
      // 
      // tChart1.Legend
      // 
      // 
      // tChart1.Legend.Title
      // 
      // 
      // tChart1.Legend.Title.Font
      // 
      this.tChart1.Legend.Title.Font.Bold = true;
      // 
      // tChart1.Legend.Title.Pen
      // 
      this.tChart1.Legend.Title.Pen.Visible = false;
      this.tChart1.Location = new System.Drawing.Point(8, 40);
      this.tChart1.Name = "tChart1";
      this.tChart1.Size = new System.Drawing.Size(616, 368);
      this.tChart1.TabIndex = 0;
      // 
      // buttonCreate
      // 
      this.buttonCreate.Location = new System.Drawing.Point(32, 8);
      this.buttonCreate.Name = "buttonCreate";
      this.buttonCreate.TabIndex = 1;
      this.buttonCreate.Text = "Create";
      this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
      // 
      // buttonImport
      // 
      this.buttonImport.Location = new System.Drawing.Point(368, 8);
      this.buttonImport.Name = "buttonImport";
      this.buttonImport.TabIndex = 1;
      this.buttonImport.Text = "Import";
      this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click);
      // 
      // buttonSave
      // 
      this.buttonSave.Location = new System.Drawing.Point(144, 8);
      this.buttonSave.Name = "buttonSave";
      this.buttonSave.TabIndex = 1;
      this.buttonSave.Text = "Save";
      this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
      // 
      // buttonClear
      // 
      this.buttonClear.Location = new System.Drawing.Point(256, 8);
      this.buttonClear.Name = "buttonClear";
      this.buttonClear.TabIndex = 2;
      this.buttonClear.Text = "Clear";
      this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click);
      // 
      // buttonEdit
      // 
      this.buttonEdit.Location = new System.Drawing.Point(480, 8);
      this.buttonEdit.Name = "buttonEdit";
      this.buttonEdit.TabIndex = 1;
      this.buttonEdit.Text = "Edit";
      this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
      // 
      // Form1
      // 
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(632, 414);
      this.Controls.Add(this.buttonClear);
      this.Controls.Add(this.buttonCreate);
      this.Controls.Add(this.tChart1);
      this.Controls.Add(this.buttonImport);
      this.Controls.Add(this.buttonSave);
      this.Controls.Add(this.buttonEdit);
      this.Name = "Form1";
      this.Text = "Form1";
      this.ResumeLayout(false);
 
    }
    #endregion
 
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
      Application.Run(new Form1());
    }
 
    private void buttonCreate_Click(object sender, System.EventArgs e)
    {
      Bubble bubble1 = CreateBubbleSeries("Bubble 1");
      bubble1.Add(10,10,2,Color.Red);
      bubble1.Add(10,20,3,Color.Blue);
      bubble1.Add(20,10,2,Color.Yellow);
      bubble1.Add(15,15,2,Color.Green);
      tChart1.Series.Add(bubble1);
    }
 
    public static Bubble CreateBubbleSeries(string seriesName)
    {
      Bubble series = new Bubble();
      series.Pointer.Style = PointerStyles.Rectangle;
      series.Pointer.InflateMargins = true;
      series.Pointer.Pen.Transparency = 90;   // Use transparent borders
      series.Squared = false;
      series.XValues.Order = ValueListOrder.None;
      series.YValues.Order = ValueListOrder.None;
      series.Marks.Visible = false;
      series.Marks.Arrow.Visible = false;
      series.Marks.ArrowLength = -6;
      series.Marks.Clip = true;
      series.Marks.Transparent = true;
      series.Marks.Shadow.Visible = true;
      series.Marks.Shadow.Transparency = 50;
      series.Title = seriesName;
      series.ColorEach = false;  // This line causes the problem
      series.ShowInLegend = false;
      return series;
    }
 
    private void buttonSave_Click(object sender, System.EventArgs e)
    {
      tChart1.Export.Template.Save(@"c:\temp\bubbleColorTest.ten");
    }
 
    private void buttonImport_Click(object sender, System.EventArgs e)
    {
      tChart1.Import.Template.Load(@"c:\temp\bubbleColorTest.ten");
      tChart1.Invalidate();
    }
 
    private void buttonClear_Click(object sender, System.EventArgs e)
    {
      tChart1.Series.RemoveAllSeries();
      tChart1.Invalidate();
    }
 
    private void buttonEdit_Click(object sender, System.EventArgs e)
    {
      tChart1.ShowEditor();
    }
 
  }
}


________________________________________
From: Narcís
Sent: Tuesday, November 22, 2005 1:50 AM
To: Walt
Subject: Re: TeeChart.NET v2 Custom Colors

Hi Walt,

I'm not able to reproduce it here using the code below and TeeChart for .NET v2 debug build available at our customer download area. Can you please test if this works for you and if necessary send us an example we can run "as-is" to reproduce the problem here?

Code: Select all

 
  private void Form1_Load(object sender, System.EventArgs e)
  {
   bubble1.Add(10,10,2,Color.Red);
   bubble1.Add(10,20,3,Color.Blue);
   bubble1.Add(20,10,2,Color.Yellow);
   bubble1.Add(15,15,2,Color.Green);
  }
 
  private void button1_Click(object sender, System.EventArgs e)
  {
   tChart1.Export.Template.Save(@"c:\temp\bubble.ten");
  }
 
  private void button2_Click(object sender, System.EventArgs e)
  {
   tChart1.Import.Template.Load (@"c:\temp\bubble.ten");
  }
 
  private void tChart1_Click(object sender, System.EventArgs e)
  {
   bubble1.Clear();
   tChart1.Series.RemoveAllSeries();
  }



Best Regards,

Narcís

----- Original Message -----
From: Walt
To: support@steema.com
Sent: Tuesday, November 22, 2005 3:12 AM
Subject: TeeChart.NET v2 Custom Colors

I can't post this on the forums because they are still down.

I upgraded a project to TeeChart.NET v2 which has a bubble series with custom colors for each bubble (but NOT ColorEach option). Everything looks ok at first, but when I save the chart to a *.ten file, then import it back, all the colors are gone (all bubbles are the same color).

Please investigate.

Thanks,

Walt

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

Post by Pep » Thu Dec 01, 2005 7:46 pm

Hi Walt,

using the latest sources and your code (with ColorEach to true) I can see the same color of Bubbles exporting and importing the Chart again. But it gets a wrong Pen color (the Border color). We'll try to fix this problem for the next maintenance release.
In meantime a solution is to set the Color again when the Chart has been loaded.

Walt
Newbie
Newbie
Posts: 35
Joined: Wed Aug 17, 2005 4:00 am
Location: San Jose, CA
Contact:

Post by Walt » Tue Dec 06, 2005 7:46 pm

Pep wrote:using the latest sources and your code (with ColorEach to true) I can see the same color of Bubbles exporting and importing the Chart again. But it gets a wrong Pen color (the Border color). We'll try to fix this problem for the next maintenance release.
In meantime a solution is to set the Color again when the Chart has been loaded.
Well, that solution definitely won't work for me because I don't have the source data available when the .TEN file is imported back into the chart control. Please do include the fix in a maintenance release soon.

Please also make sure that you can set the color of a series without forcing the points to use that color (in my code below, just add "bubble1.Color = Color.Brown;" before adding the points). This allows the series to have a particular color in the legend, but the points can be any color (e.g. various shades of the "main" color). I think that points should always use the specific color assigned to them and only default to the series color if no specific color is specified. Again, my code was working ok with v1, but it isn't working anymore in v2.

Thank you for your support.

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

Post by Narcís » Wed Dec 07, 2005 10:22 am

Hi Walt,

Ok, I've added your request to the bug you reported.
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