Page 1 of 1

Series only show up in black

Posted: Wed May 10, 2006 1:35 pm
by 9082850
I am using version 6 of Teechart in C#.NET 1.1

I have created a template with two series. When I import this template, clear out the series, and add in fresh data, my series trun to black. If I just import the template without clearing or adding data the colors do show up.

Any ideas?

Thank you

template file

Code: Select all

object TChartChart
  Left = 12
  Top = 102
  Width = 900
  Height = 540
  Gradient.EndColor = 12615680
  Gradient.MidColor = 16744448
  Gradient.StartColor = 12615680
  Title.Text.Strings = (
    'TeeChart')
  BottomAxis.DateTimeFormat = 'dd mmm yy'
  LeftAxis.AxisValuesFormat = '0.0'
  LeftAxis.MaximumOffset = 10
  LeftAxis.MinimumOffset = 10
  Legend.Visible = False
  RightAxis.Automatic = False
  RightAxis.AutomaticMaximum = False
  RightAxis.AutomaticMinimum = False
  RightAxis.Maximum = 0.000000000100000000
  RightAxis.Minimum = 0.000000000000220751
  TopAxis.Automatic = False
  TopAxis.AutomaticMaximum = False
  TopAxis.AutomaticMinimum = False
  TopAxis.Maximum = 0.000000000099877301
  TopAxis.Minimum = -0.000000000000122699
  View3D = False
  Zoom.Pen.Mode = pmNotXor
  Color = clWhite
  PrintMargins = (
    15
    26
    15
    26)
  object Series0: TBarSeries
    Marks.ArrowLength = 20
    Marks.Callout.Brush.Color = clBlack
    Marks.Callout.Length = 20
    Marks.Visible = False
    SeriesColor = clBlue
    Gradient.Direction = gdTopBottom
    XValues.Name = 'X'
    XValues.Order = loAscending
    YValues.Name = 'Bar'
    Data = {
      04100000003739F38312D2D6BF07382F31352F303665F6078CBC0DE1BF07382F
      31362F3036D09589672D0BE0BF07382F31372F303604DEF67F882ED5BF07382F
      31382F30364DA0FC6C9ECEEA3F07382F31392F30361F938B39EBD7DB3F07382F
      32322F3036E6751A84E48ED03F07382F32332F30364A8C4CE6AFA3E93F07382F
      32342F3036174F99489771F23F07382F32352F3036733740C3F7ABF23F07382F
      32362F3036661BD117EB08E83F07382F32392F30361B8015C3599FF03F07382F
      33302F30361A5FE6EFF765054007382F33312F303648401D2490F9084006392F
      312F303565097C3C197B074006392F322F3035F7353B3F7D5E014006392F352F
      3036}
  end
  object Series1: TLineSeries
    Marks.ArrowLength = 8
    Marks.Callout.Brush.Color = clBlack
    Marks.Callout.Length = 8
    Marks.Visible = False
    SeriesColor = clRed
    ClickableLine = False
    Pointer.InflateMargins = True
    Pointer.Style = psRectangle
    Pointer.Visible = False
    XValues.Name = 'X'
    XValues.Order = loAscending
    YValues.Name = 'Y'
    Data = {
      0410000000000000000000000007382F31352F303634351C6BA2DEEA3F07382F
      31362F3036BAD96980AD85CC3F07382F31372F3036004F7C8A454EEC3F07382F
      31382F3036224B825391EB0A4007382F31392F3036AC6DD490CC13054007382F
      32322F30369CC420B07268064007382F32332F3036D53BE8416781F23F07382F
      32342F3036E91F97E9833CCABF07382F32352F3036BA3645000540DB3F07382F
      32362F303656B69BC9E313C1BF07382F32392F30366280F0DD583D014007382F
      33302F30365D129A428905044007382F33312F30364EC6A873AD50EA3F06392F
      312F303520074C56A625F03F06392F322F3035D9416E3BF9BAE63F06392F352F
      3036}
  end
end
C# code

Code: Select all

TeeChart.TChartClass tChart = new TeeChart.TChartClass();
tChart.Import.LoadFromFile(Server.MapPath("~/Charting/templates/myChart.tee"));
TeeChart.ISeries seriesVol = tChart.Series(0);
TeeChart.ISeries seriesRet = tChart.Series(1);

seriesVol.Clear();
seriesRet.Clear();


seriesVol.AddXY( 0, -0.25, "15 Aug 05", 0);
seriesVol.AddXY( 1, -0.5, "16 Aug 05", 0);
seriesVol.AddXY( 2, -0.75, "17 Aug 05", 0);
seriesVol.AddXY( 3, 0.5, "18 Aug 05", 0);
seriesVol.AddXY( 4, 1.0, "19 Aug 05", 0);
seriesVol.AddXY( 5, 0.75, "22 Aug 05", 0);
seriesVol.AddXY( 6, 1.2, "23 Aug 05", 0);
seriesVol.AddXY( 7, 4.0, "24 Aug 05", 0);
seriesVol.AddXY( 8, 5.0, "25 Aug 05", 0);
seriesVol.AddXY( 9, 4.5, "26 Aug 05", 0);
seriesVol.AddXY( 10, 4.5, "29 Aug 05", 0);

seriesRet.AddXY( 0, 0.0, "15 Aug 05", 0);
seriesRet.AddXY( 1, 1.5, "16 Aug 05", 0);
seriesRet.AddXY( 2, .75, "17 Aug 05", 0);
seriesRet.AddXY( 3, -0.3, "18 Aug 05", 0);
seriesRet.AddXY( 4, 1.0, "19 Aug 05", 0);
seriesRet.AddXY( 5, 0.75, "22 Aug 05", 0);
seriesRet.AddXY( 6, 1.2, "23 Aug 05", 0);
seriesRet.AddXY( 7, 5.0, "24 Aug 05", 0);
seriesRet.AddXY( 8, 4.0, "25 Aug 05", 0);
seriesRet.AddXY( 9, 2.5, "26 Aug 05", 0);
seriesRet.AddXY( 10, 0.0, "29 Aug 05", 0);


//tChart.Series(0).Color = 0x0000FF;
//tChart.Series(1).Color = 0xFF0000;

tChart.Height = 540;
tChart.Width = 900;

//write out the chart
Response.BinaryWrite( (byte[])tChart.Export.asGIF.SaveToStream() );
Response.End();

Posted: Fri May 12, 2006 2:49 pm
by narcis
Hi pngny1,

This is because you are setting them to black by setting the last AddXY method's argument to zero (which represents black color). You can solve the problem by using:

Code: Select all

			tChart.Import.LoadFromFile(Server.MapPath("~/Charting/templates/myChart.tee")); 
			TeeChart.ISeries seriesVol = tChart.Series(0); 
			TeeChart.ISeries seriesRet = tChart.Series(1); 

			seriesVol.Clear(); 
			seriesRet.Clear(); 


			seriesVol.AddXY( 0, -0.25, "15 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 1, -0.5, "16 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 2, -0.75, "17 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 3, 0.5, "18 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 4, 1.0, "19 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 5, 0.75, "22 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 6, 1.2, "23 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 7, 4.0, "24 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 8, 5.0, "25 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 9, 4.5, "26 Aug 05", tChart.Series(0).Color); 
			seriesVol.AddXY( 10, 4.5, "29 Aug 05", tChart.Series(0).Color); 

			seriesRet.AddXY( 0, 0.0, "15 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 1, 1.5, "16 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 2, .75, "17 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 3, -0.3, "18 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 4, 1.0, "19 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 5, 0.75, "22 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 6, 1.2, "23 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 7, 5.0, "24 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 8, 4.0, "25 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 9, 2.5, "26 Aug 05", tChart.Series(1).Color); 
			seriesRet.AddXY( 10, 0.0, "29 Aug 05", tChart.Series(1).Color); 


			//tChart.Series(0).Color = 0x0000FF; 
			//tChart.Series(1).Color = 0xFF0000; 

			tChart.Height = 540; 
			tChart.Width = 900; 

			//write out the chart 
			Response.BinaryWrite( (byte[])tChart.Export.asGIF.SaveToStream() ); 
			Response.End();

Posted: Mon May 15, 2006 4:18 pm
by 9082850
Thanks so much for your help. I didn't realize what that parameter was for.