Page 1 of 2
MultiLine Marks
Posted: Wed Dec 03, 2008 7:30 am
by 13047002
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
Posted: Wed Dec 03, 2008 9:56 am
by narcis
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;
Posted: Wed Dec 03, 2008 11:01 am
by 13047002
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
Posted: Wed Dec 03, 2008 11:25 am
by narcis
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.
Posted: Wed Dec 03, 2008 11:25 am
by 13047002
ok many thx
Posted: Wed Dec 03, 2008 12:30 pm
by 13047002
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?
Extended but first column still has no colour.
Posted: Wed Dec 03, 2008 12:48 pm
by 13047002
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);
Posted: Wed Dec 03, 2008 1:11 pm
by narcis
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:
This solves first column issue.
Regarding bottom axis labels you already found the solution setting bottom axis labels style to AxisLabelStyle.Value.
Posted: Wed Dec 03, 2008 1:21 pm
by 13047002
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
Posted: Wed Dec 03, 2008 1:27 pm
by 13047002
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.
Posted: Wed Dec 03, 2008 2:00 pm
by narcis
Hi Luke,
Adding this line:
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?
Posted: Wed Dec 03, 2008 2:02 pm
by 13047002
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.
Posted: Wed Dec 03, 2008 2:15 pm
by narcis
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.
Posted: Wed Dec 03, 2008 3:18 pm
by 13047002
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
Posted: Thu Dec 04, 2008 10:14 am
by 13047002
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