Page 1 of 1

Gant Chart-Color Member Problem

Posted: Thu Feb 02, 2006 3:32 pm
by 9640091
Hi,

I developed an application with Evaluation version of Pro2 for .Net... I used gant chart with a datatable as its datasource. Nothing was wrong with this application. But i when i purchased and set up the full version ColorMember attribute didn't work.
Is it a version problem? (I didn't changed the code)
Any idea?

Bora.

Posted: Mon Feb 06, 2006 1:00 pm
by narcis
Hi Bora,

The problem may be because it is necessary to populate the NextTasks value list as shown here:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			tChart1.Axes.Bottom.Labels.Style=AxisLabelStyle.Value;
			CreateTable();
			LoadData();		
		}		

		private void CreateTable()
		{
			Random r=new Random(255);
			
			// Create DataTable
			sourceTable = new DataTable("sourceTable");
			colStart = new DataColumn("StartDates",Type.GetType("System.Double"));
			colEnd = new DataColumn("EndDates",Type.GetType("System.Double"));
			colYData = new DataColumn("YData",Type.GetType("System.Double"));
			colTask = new DataColumn("NextTask",Type.GetType("System.Double"));

			colDesc = new DataColumn("Desc",Type.GetType("System.String"));
			colColor = new DataColumn("Color",Type.GetType("System.Object"));

			sourceTable.Columns.Add(colStart);
			sourceTable.Columns.Add(colEnd);
			sourceTable.Columns.Add(colYData);
			sourceTable.Columns.Add(colDesc);
			sourceTable.Columns.Add(colColor);
			sourceTable.Columns.Add(colTask);

			// Add table items.
			DataRow NewRow;
			double lastVal=32000;
			for(int i = 0; i <10; i++)
			{
				Color cc=Color.FromArgb(r.Next(255),r.Next(255),r.Next(255));
				NewRow = sourceTable.NewRow();
				NewRow["Desc"] = "Label"+i.ToString();
				NewRow["StartDates"] = lastVal;
				NewRow["EndDates"] = lastVal+10;
				NewRow["YData"] = r.Next(10);
				NewRow["Color"] = cc;
				NewRow["NextTask"] = 0;
				sourceTable.Rows.Add(NewRow);
				lastVal=lastVal+5+r.Next(5);
			}
		}

		private void LoadData()
		{
			tChart1[0].Clear();
			gantt1.StartValues.DataMember = "StartDates";
			gantt1.EndValues.DataMember = "EndDates";
			gantt1.YValues.DataMember = "YData";
			gantt1.NextTasks.DataMember = "NextTask";
			gantt1.ColorMember = "Color";

			gantt1.DataSource = sourceTable;
			gantt1.CheckDataSource();
		}

Posted: Mon Feb 06, 2006 1:29 pm
by 9640091
Hi,

I'd set the NextTask's DataMember before. As i wrote my application was working in evaluation version. I installed Licensed Version and this problem occured. I didn't make any code change. I think problem is different. But what?

Thanks.

Bora

Posted: Mon Feb 06, 2006 3:13 pm
by narcis
Hi Bora,

Could you please test if it works and if not let us know which error do you get and which TeeChart version are you using? As I mentioned before, the code above works for me here using latest TeeChart for .NET v2 release.