Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
745
EmptyChart - Change Style
posted

Hi.

I'm using Infragistics version 12.1.20121.2048.

I've built a bar chart and it works fine.

When the graphic has no data it shows a message that is defined through the property EmptyChartText. But I'd like to change the font-size of this message because it is too big.

Is that possible? I tried to do this:

Me.UltraChart1.Font.Size = New System.Web.UI.WebControls.FontUnit(10, UnitType.Pixel)

But the font size remains the same for the message.

Thank you

Parents
No Data
Reply
  • 53790
    Verified Answer
    posted

    Hello soniaalves,

    Maybe one possible approach could be if you are using your FillSceneGraph event. For example:

     private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
            {
                foreach (Primitive pr in e.SceneGraph)
                {
                    if (e.SceneGraph.Count == 3 && pr.GetType() == typeof(Text))
                    {
                        LabelStyle ls = ((Text)pr).GetLabelStyle();
                        ls.Font = new Font("Ariel", 12);
                        ls.FontColor = Color.Green;
                        ls.FontSizeBestFit = false;
                    }
                }
            }

    The result will be screenshot 1 (see below)

    Another option could be if you set size of your Text primitive. For example:

    private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
            {
                foreach (Primitive pr in e.SceneGraph)
                {
                    if (e.SceneGraph.Count == 3 && pr.GetType() == typeof(Text))
                    {
                       ((Text)pr).FitsInBox = false;
                        ((Text)pr).bounds = new Rectangle(100, 0, 500, 50);
                    }
                }
            }

    The result will be screenshot 2

    Let me know if you have any questions.

Children