Formating Marker Labels for Line Chart

Answered (Verified) This post has 1 verified answer | 3 Replies | 2 Followers Thread's RSS feed.

flowerdj
Points 825
Replied On: Fri, Nov 19 2010 6:15 PM Reply

Is there a way that the numbers that show up above the markers in a line chart to be formatted and is there a way to move them below the markers?

  • Post Points: 20

Verified Answer

Answered (Verified) Replied On: Thu, Nov 25 2010 6:21 AM Reply
Verified by flowerdj

In order to achieve that you can use the Format and the LabelDistance properties as follows: 

<igCA:XamWebChart>

            <igCA:XamWebChart.Series>

                <igCA:Series ChartType="Line">

                    <igCA:Series.Marker>

                        <igCA:Marker Format="{}{Value:c}" LabelDistance="-5"/>

                    </igCA:Series.Marker>

                    <igCA:Series.DataPoints>

                        <igCA:DataPoint Value="40"/>

                        <igCA:DataPoint Value="50"/>

                        <igCA:DataPoint Value="60"/>

                        <igCA:DataPoint Value="70"/>

                    </igCA:Series.DataPoints>

                </igCA:Series>

            </igCA:XamWebChart.Series>

</igCA:XamWebChart>

Let me know if that works for you.

Sincerely,
Vlad
Developer Support Engineer, MCTS
Infragistics Inc.
www.infragistics.com/support

  • Post Points: 40

All Replies

Answered (Verified) Replied On: Thu, Nov 25 2010 6:21 AM Reply
Verified by flowerdj

In order to achieve that you can use the Format and the LabelDistance properties as follows: 

<igCA:XamWebChart>

            <igCA:XamWebChart.Series>

                <igCA:Series ChartType="Line">

                    <igCA:Series.Marker>

                        <igCA:Marker Format="{}{Value:c}" LabelDistance="-5"/>

                    </igCA:Series.Marker>

                    <igCA:Series.DataPoints>

                        <igCA:DataPoint Value="40"/>

                        <igCA:DataPoint Value="50"/>

                        <igCA:DataPoint Value="60"/>

                        <igCA:DataPoint Value="70"/>

                    </igCA:Series.DataPoints>

                </igCA:Series>

            </igCA:XamWebChart.Series>

</igCA:XamWebChart>

Let me know if that works for you.

Sincerely,
Vlad
Developer Support Engineer, MCTS
Infragistics Inc.
www.infragistics.com/support

  • Post Points: 40
flowerdj
Points 825
Replied On: Tue, Nov 30 2010 10:53 AM Reply

This waa a good solution, however I had to convert it to a code behind situation. I might suggest that you supply us developers with both the front end and code behind solutions.

Thanks for your help

  • Post Points: 20
Replied On: Wed, Dec 1 2010 2:36 AM Reply

You can do the same thing in CodeBehind as well e.g.

void MainPage_Loaded(object sender, RoutedEventArgs e)

        {

            Marker marker = new Marker();

            marker.Type = MarkerType.Circle;

            marker.LabelDistance = -5.0;

            marker.Format = "{Value:c}";

 

            Series lineSeries = new Series();

            lineSeries.ChartType = ChartType.Line;

            lineSeries.Marker = marker;

            lineSeries.DataPoints.Add(new DataPoint() { Value = 40 });

            lineSeries.DataPoints.Add(new DataPoint() { Value = 50 });

            lineSeries.DataPoints.Add(new DataPoint() { Value = 60 });

            lineSeries.DataPoints.Add(new DataPoint() { Value = 70 });

 

            xwc1.Series.Add(lineSeries);

        }

Hope this helps.

Sincerely,
Vlad
Developer Support Engineer, MCTS
Infragistics Inc.
www.infragistics.com/support

  • Post Points: 5
Page 1 of 1 (4 items) | RSS