Hi,
I'm looking way to change selected label's font colorI know how to change all of them but I'd like to change specific one (see attached picture)
Hello Maciej,
We are still following this forum thread.
Please feel free to let us know if the provided approach suits your requirements.
Thanks.
Maciej,
This could be achieved by the following code put after the last foreach in the 'FillSceneGraph'. It would look like this:
List<Primitive> list;
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
list = new List<Primitive>();
foreach (Primitive pr in e.SceneGraph)
Box pl = pr as Box;
if (pl != null && pl.Series != null && pl.Layer.LayerID == "chartLayer2")
pl.rect = new Rectangle(pl.rect.X + (pl.rect.Width / 2) + 1, pl.rect.Y, pl.rect.Width - (pl.rect.Width / 2), pl.rect.Height);
}
if (pl != null && pl.Series != null && pl.Layer.LayerID == "chartLayer1")
pl.rect = new Rectangle(pl.rect.X, pl.rect.Y, pl.rect.Width - (pl.rect.Width / 2), pl.rect.Height);
Text txt = new Text();
txt.PE.Fill = Color.Yellow;
txt.SetTextString(pl.Series.Label);
txt.bounds.Location = new Point(pl.rect.X + (pl.rect.Width / 2), pl.rect.Y + pl.rect.Height + 10);
list.Add(txt);
foreach (Text txt in list) e.SceneGraph.Add(txt);
foreach (Text txt in list)
//You could put a condition here
txt.PE.Fill = Color.Magenta;
Please feel free to let me know if a question about our tool set comes up on your mind.
Apologies not being precise!
By selected I meant label I've chosen / wanted to mark.
(Didnt meant runtime selection/ mouse hoover etc)
For example I might have lebels with people names. I know few of them are absent. I want those names mark in different colour
What do you mean be selected? I am not sure what you are selecting exactly and I do not have any knowledge of any selectable elements in the chart. I might be thinking about something else then. Is it possible to make a video with the steps you are doing and the moment you want to change a label's color, so I can try and make a new sample for you?
Hi Boris,
Looked into your example (thanks) see there you changed color of all Axis X labels to yellow (Item 1 - Item 4).
Also you have set color of hoovered bar's label to pink
I'm looking to change color only selected (by me) labels (eg "Item 2")
Is this possible ?