?
Solved

Show line series label only once...

Posted on 2014-08-07
4
Medium Priority
?
264 Views
Last Modified: 2014-08-07
By setting the following property to true:

series2.IsValueShownAsLabel = true;

Understandably, I am getting series value show for all occurrences.

Question: How can I change my code to make it show only once as displayed on the attached image?

Thank you.
Series series2 = new Series("Default2");
            series2.ChartType = SeriesChartType.Line;
            series2.Color = System.Drawing.Color.Purple;
            series2.BorderWidth = 2; 
            series2.BorderDashStyle = ChartDashStyle.Dash;
            series2.IsValueShownAsLabel = true; //********************************
            chart.Series.Add(series2);

Open in new window

chartLabel.png
0
Comment
Question by:Mike Eghtebas
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 40247583
should be as easy as:
                series2.IsValueShownAsLabel = false;
                series2.Points[0].IsValueShownAsLabel = true;

Open in new window

0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40247619
Hi Robert,

I am getting ArgumentOutOfRangeException error at line 14.
Chart chart = new Chart();

            Series series = new Series("Default");
            series.ChartType = SeriesChartType.Column;
            chart.Series.Add(series);

            Series series2 = new Series("Default2");
            series2.ChartType = SeriesChartType.Line;
            series2.Color = System.Drawing.Color.Purple;// change color to put
            series2.BorderWidth = 2; // this is actually the line width...
            series2.BorderDashStyle = ChartDashStyle.Dash;
            //series2.IsValueShownAsLabel = true;
            series2.IsValueShownAsLabel = false;
            series2.Points[0].IsValueShownAsLabel = true;
            chart.Series.Add(series2);

Open in new window

0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 2000 total points
ID: 40247627
Ah, I'm working off a different version of your code I think. Make sure this is called after the chart.DataBind() call. Also couldn't hurt probably to double check in the code that series2.Points.Count > 0.
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 40247633
That was it.

Thanks,

Mike
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

864 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