rahularyansharma
rahularyansharma

Reputation: 10755

how to make annotation text in two lines instead of one line which cross chart in case text is long?

I am using asp.net 3.5 chart control and for showing message when there is no data present . I have used this method

 if (dsAllDepartment.Tables[0].Rows.Count == 0)
            {
                System.Web.UI.DataVisualization.Charting.TextAnnotation annotation =
                new System.Web.UI.DataVisualization.Charting.TextAnnotation();

                annotation.Text =ddldepartment.SelectedItem.Text+"  विभाग के लिए  डाटा उपलब्ध नहीं है";
                annotation.X = 5;
                annotation.Y = 25;
                annotation.Font = new System.Drawing.Font("Arial", 12);
                annotation.ForeColor = System.Drawing.Color.Red;
                chAllDepartmentAllActivity.Annotations.Add(annotation);           
            }

its working but problem is when text too long its cross the chart instead of appearing in two lines ...

chart where annotations cross chart

Upvotes: 0

Views: 1232

Answers (1)

Anders Gustafsson
Anders Gustafsson

Reputation: 15971

If you are OK with explicit line breaks in your text, try inserting \n in "strategic" places. This way you will at least be able to control your manually written text.

Upvotes: 1

Related Questions