MultiLine Marks

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

MultiLine Marks

Post by Luke » Wed Dec 03, 2008 7:30 am

I can set the Marks MultiLine property to true but it has no efect. Do I need to set clip to false as well. What drives the mark text to appear on multiple lines?

Also on the ColorGrid Control I want to add Multiple cells with custom colors. I can do this with add(x,z,y,text,color). But how can I modify what labels are shown on the Bottom axis. If I have say a 10 by 10 grid I want to display years 1998-2007 along the bottom axis.

Thx

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 03, 2008 9:56 am

Hi Luke,
I can set the Marks MultiLine property to true but it has no efect. Do I need to set clip to false as well. What drives the mark text to appear on multiple lines?
Marks are split in lines when you choose a "compound" mark style like: MarksStyles.LabelPercent, MarksStyles.LabelPercentTotal or MarksStyles.XY.

You can also make marks having multiple lines adding line breaks into them, for example:

Code: Select all

			line1.Add(25, "mark line 1\nmark line 2");
Using GetMarkText event you can automatically parse marks text too. You could replace blank spaces for line brakes or implement any customization you wish.
Also on the ColorGrid Control I want to add Multiple cells with custom colors. I can do this with add(x,z,y,text,color). But how can I modify what labels are shown on the Bottom axis. If I have say a 10 by 10 grid I want to display years 1998-2007 along the bottom axis.
In that case you can do something like this:

Code: Select all

			Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

			Random y = new Random();

			for (int x = 0; x < 10; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					colorGrid1.Add(x, y.Next(), z , Convert.ToString(1997+x));
				}
			}

			tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Text;
Alternatively you can do this:

Code: Select all

			Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

			int year = DateTime.Now.Year-11;
			Random y = new Random();

			for (int x = year; x < DateTime.Now.Year; x++)
			{
				for (int z = 0; z < 10; z++)
				{					
					colorGrid1.Add(x, y.Next(), z );
				}
			}

			//tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
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

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 11:01 am

Hi

Thats fine but what if the Mark Texts are different to the years

if each point has a different label / text and years are displayed horizontally.

so column one has year 2005 with cells Cars 55,Bus 80,Bike 15

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 03, 2008 11:25 am

Hi Luke,

Adding x values as DateTime values as in the second code snippet I posted should solve this problem. There you can set a label for each point.
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

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 11:25 am

ok many thx

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 12:30 pm

Hi I tried your code with slight mod

int year = DateTime.Now.Year - 11;
Random y = new Random();

for (int x = year; x < DateTime.Now.Year; x++)
{
for (int z = 0; z < 10; z++)
{
colorGrid.Add(x, y.Next(), z,"Test" + x.ToString() + "-" + z.ToString(),Color.Yellow);
}
}
colorGrid.Marks.Visible = true;
colorGrid.Marks.Font.Size = 6;
colorGrid.Marks.Transparent = true;
colorGrid.Marks.Style = MarksStyles.LabelPercent;
colorGrid.Marks.MultiLine = true;
tChart.Axes.Bottom.Labels.Style = AxisLabelStyle.Text;
tChart.Series.Add(colorGrid);

Ths first column has no colours and I am unable to see the bottom axis as year?

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Extended but first column still has no colour.

Post by Luke » Wed Dec 03, 2008 12:48 pm

int year = DateTime.Now.Year - 11;
Random y = new Random();

for (int x = year; x < DateTime.Now.Year; x++)
{
for (int z = 0; z < 10; z++)
{
colorGrid.Add(x, y.Next(), z,"Test" + x.ToString() + "-" + z.ToString(),Color.Yellow);
}
}
colorGrid.Marks.Visible = true;
colorGrid.Marks.Font.Size = 6;
colorGrid.Marks.Transparent = true;
colorGrid.Marks.Style = MarksStyles.LabelPercent;
colorGrid.Marks.MultiLine = true;
colorGrid.HorizAxis = HorizontalAxis.Bottom;
tChart.Axes.Visible = true;
tChart.Axes.Bottom.Visible = true;
tChart.Axes.Left.Visible = false;
tChart.Axes.Bottom.Labels.Style = AxisLabelStyle.Value;
tChart.Axes.Bottom.Labels.ValueFormat = "0000";
tChart.Axes.Bottom.Increment = 1;
tChart.Series.Add(colorGrid);

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 03, 2008 1:11 pm

Hi Luke,
Ths first column has no colours and I am unable to see the bottom axis as year?
Sorry, I forgot to set IrregularGrid=true in my example:

Code: Select all

			colorGrid.IrregularGrid = true;
This solves first column issue.

Regarding bottom axis labels you already found the solution setting bottom axis labels style to AxisLabelStyle.Value.
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

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 1:21 pm

Do I need to set centred values too?

I f I do this the complete column is colored however now top row in grid is white ;-)

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 1:27 pm

tChart.Axes.Left.AutomaticMaximum = false;
tChart.Axes.Left.Maximum = data.Length+0.5;


had to do this. Seems automatic left axis does not work to well with the ColorGrid. It needs to be set manually for last cell to be coloured.

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 03, 2008 2:00 pm

Hi Luke,

Adding this line:

Code: Select all

			colorGrid.CenteredPoints = true;
To your code works fine for me here using latest TeeChart for .NET v3 release available at the client area. Which TeeChart version are you using?
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

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 2:02 pm

the latest one too. just when i use dmy objects the toprow would hav no colour. seems the automaticmax was 1 to low. so I just had to increment by 1.

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 03, 2008 2:15 pm

Hi Luke,

I'm not able to reproduce it here using this code:

Code: Select all

			tChart1.Aspect.View3D = false;
			tChart1.Legend.Visible = false;

			Steema.TeeChart.Styles.ColorGrid colorGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
			colorGrid.IrregularGrid = true;

			int year = DateTime.Now.Year - 11;
			Random y = new Random();

			for (int x = year; x < DateTime.Now.Year; x++)
			{
				for (int z = 0; z < 10; z++)
				{
					colorGrid.Add(x, y.Next(), z, "Test" + x.ToString() + "-" + z.ToString(), Color.Yellow);
				}
			}
			colorGrid.Marks.Visible = true;
			colorGrid.Marks.Font.Size = 6;
			colorGrid.Marks.Transparent = true;
			colorGrid.Marks.Style = Steema.TeeChart.Styles.MarksStyles.LabelPercent;
			colorGrid.Marks.MultiLine = true;
			colorGrid.HorizAxis = Steema.TeeChart.Styles.HorizontalAxis.Bottom;

			tChart1.Axes.Visible = true;
			tChart1.Axes.Bottom.Visible = true;
			tChart1.Axes.Left.Visible = false;
			tChart1.Axes.Bottom.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
			tChart1.Axes.Bottom.Labels.ValueFormat = "0000";
			tChart1.Axes.Bottom.Increment = 1;
			//tChart1.Series.Add(colorGrid);		

			colorGrid.CenteredPoints = true;
Can you please modify it so that I can reproduce the issue here?

Thanks in advance.
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

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Wed Dec 03, 2008 3:18 pm

Hi

I think its just because I had z+1 when adding the data points. as soon as I removed the +1 it was fine.

Thx

Luke

Luke
Newbie
Newbie
Posts: 68
Joined: Thu Oct 11, 2007 12:00 am

Post by Luke » Thu Dec 04, 2008 10:14 am

Is there a way to change the forecolor for individual Marks. e.g. for some cells on the color grid I want Black Text and other White.

Thx

Post Reply