PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Data Labels on Line Chart and YAxis Orientation
http://forum.pdfsharp.com/viewtopic.php?f=2&t=2607
Page 1 of 1

Author:  Lotpath [ Tue Oct 08, 2013 12:11 am ]
Post subject:  Data Labels on Line Chart and YAxis Orientation

Hello, I have two problems I just cant seem to work past.
#1: I have created a line graph and need to show data labels on some of the plot points. Is this possible? I have not found any way to show a data label anywhere on a line chart.
This is what I tried so far in C#
Code:
var lineSeries = lineChart.SeriesCollection.AddSeries();
            lineSeries.ChartType = ChartType.Line;
            lineSeries.Add(new double[] { 0.43, 2.13, 2.86, 4.62, 7.04, 10.29, 14.76, 20.07, 26.78, 35.98, 47.02, 57.94, 59.85 });
            lineSeries.LineFormat.Color = Colors.Red;
            lineSeries.Name = "4 Year Average";
            lineSeries.HasDataLabel = true;
            lineSeries.DataLabel.CreateValue("38.98");
            lineSeries.DataLabel.Font.Color = Colors.Black;
            lineSeries.DataLabel.Type = DataLabelType.Value;
            lineSeries.DataLabel.Position = DataLabelPosition.InsideBase;

I am able to get this to work with a ColumnChart but LineChart seems to refuse it. Anyone had any luck with this? This is what I need it to look like.
Image

#2 I am setting the YAxis.Title.Caption and have tried changing the YAxis.Title.Orientation = 90; This correctly turns the text the way I want it (vertical), but the high property is still the same as the original text, so it is all squished inside. There is no width or height property to set. How do I do this? This is my code.
Code:
lineChart.YAxis.MajorTickMark = TickMarkType.Outside;
            lineChart.YAxis.Title.Caption = "Inches/Acre";
            lineChart.YAxis.Title.VerticalAlignment = VerticalAlignment.Center;
            lineChart.YAxis.Title.Orientation = 90;
            lineChart.YAxis.Title.Alignment = HorizontalAlignment.Center;
            lineChart.YAxis.HasMajorGridlines = true;

Image

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/