position of ... series2.IsValueShownAsLabel = true;  c#

Posted on 2014-08-13
Medium Priority
Last Modified: 2014-08-14
The following line of code

series2.IsValueShownAsLabel = true;      

shows the data values for series2 above the line (default setting I guess).

70_____________________________________________________________     <-- above the line

Question: How can I make the value position on the line or below the line as shown below:

70-----------------------------------------------------------------------          <-- on the line
______________________________________________________________         <-- below the line

Thank you.
Question by:Mike Eghtebas
  • 2
LVL 35

Expert Comment

by:Robert Schutt
ID: 40260224
You use CustomProperties on series or point for that, for example:
series2.IsValueShownAsLabel = true;
series2.CustomProperties = "LabelStyle=Center";
series2.Points[0].CustomProperties = "LabelStyle=Bottom";

Open in new window

Description of LabelStyle:  / http://msdn.microsoft.com/en-us/library/dd489245(v=vs.110).aspx 
All custom properties (note that not all are available for column chart): http://msdn.microsoft.com/en-us/library/dd456764(v=vs.110).aspx 
Other ways to set custom properties: http://msdn.microsoft.com/en-us/library/dd456700(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
LVL 35

Accepted Solution

Robert Schutt earned 2000 total points
ID: 40260253
I see in your other new question that you were already close to a solution but using BarLabelStyle, which is for use in a bar chart.
Also, it's important to note that SmartLabelStyle must be disabled so for example:
                chart.Series["Default2"].SmartLabelStyle.Enabled = false;
                chart.Series["Default2"]["LabelStyle"] = "Center";  // This will change Label Position
                chart.Series["Default2"].LabelAngle = 90;    // This will rotate Data Label

Open in new window

So that second line is one of the alternative ways to set a Custom Property, maybe a bit nicer than what I did in my initial post on this question.
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40261455
Thank you very much as always.


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question