cannt change the color of marks

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

cannt change the color of marks

Post by elmec » Thu May 22, 2014 4:34 am

The color cannt be changed by the following code.
BTW, I am using the newest Teechart(2014) for C++Builder XE4 Firemonkey HD APP.

Code: Select all

//---------------------------------------------------------------------------

#include <fmx.h>
#pragma hdrstop
#include <iostream>
#include <string>

#include "Unit12.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)

#pragma resource "*.fmx"
TForm12 *Form12;


__fastcall TForm12::TForm12(TComponent* Owner)
	: TForm(Owner)
{

	seriesSeries1->Marks->Visible = true;
	seriesSeries1->AddXY(10,10, "aa", claRed);
	seriesSeries1->AddXY(20,10, "bb", claBlue);

}

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: cannt change the color of marks

Post by elmec » Thu May 22, 2014 4:34 am

changcolor.jpg
changcolor.jpg (37.18 KiB) Viewed 16791 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: cannt change the color of marks

Post by Yeray » Thu May 22, 2014 11:33 am

Hello,

Is this a TLineSeries? I can't reproduce this with a TLineSeries.
If it's a TFastLineSeries, note this.

Reading the thread title again it mentions the marks. So I'm not sure if the intention of the code you posted was to set red and blue colors to the marks or to the line pen. If you want to change the marks colors, you have to use the corresponding Marks Items array after populating the series:

Code: Select all

   Chart1->View3D = false;

   TFastLineSeries *seriesSeries1 = new TFastLineSeries(this);
   Chart1->AddSeries(seriesSeries1);

   seriesSeries1->Marks->Visible = true;
   seriesSeries1->AddXY(10,10, "aa", claRed);
   seriesSeries1->AddXY(20,10, "bb", claBlue);

   seriesSeries1->Marks->Item[0]->Color = claRed;
   seriesSeries1->Marks->Item[1]->Color = claBlue;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: cannt change the color of marks

Post by elmec » Thu May 22, 2014 1:02 pm

Thank you.
I meant the label..and I used the TFastLineSeries...
SO I will change to TLineSeries and try again.

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: cannt change the color of marks

Post by elmec » Thu May 22, 2014 1:10 pm

But I am confused about the result of the following code.

Code: Select all

    TFastLineSeries* line = new TFastLineSeries(Chart1);
    line->ParentChart = Chart1;
    line->Marks->Visible = true;

    line->FillSampleValues(10);

    // the count fo marks is  ZERO!!!   Even all the marks are showed just like in the attachment.
    ShowMessage(line->Marks->Items->Count);
Attachments
marks count.png
marks count.png (15.54 KiB) Viewed 16754 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: cannt change the color of marks

Post by Yeray » Fri May 23, 2014 10:03 am

Hello,

The problem here is that the Marks->Items array is being populated as you access it; if you access the Marks->Item[index], the array is populated from the item 0 to the item being accessed, and Marks->Items->Count always indicates how many items are populated in the array.
Ie, if you access to the Item[0], then the Count will give you 1:

Code: Select all

	line->Marks->Item[0];
	ShowMessage(line->Marks->Items->Count);
Or, if you access the item[3], then the Count will give you 4:

Code: Select all

	line->Marks->Item[3];
	ShowMessage(line->Marks->Items->Count);
Then, if you want to get the complete Count, you have to access the last item. Ie:

Code: Select all

	line->Marks->Item[line->Count()-1];
	ShowMessage(line->Marks->Items->Count);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

elmec
Advanced
Posts: 129
Joined: Mon Aug 26, 2013 12:00 am

Re: cannt change the color of marks

Post by elmec » Sat May 24, 2014 5:50 am

Thank you !

Post Reply