Step 3 of 4: Format the Axes
In this step, you will add a ChartView object so you can customize the X-Axis.
To format the axes for Chart for Silverlight programmatically in the code behind file
Add the following code in the Public MainPage() class to format the chart axes:
' set axes titles
C1Chart1.View.AxisY.Title = New TextBlock(New Run("Kitchen Electronics"))
C1Chart1.View.AxisX.Title = New TextBlock(New Run("Price"))
' set axes bounds
C1Chart1.View.AxisX.Min = 0
C1Chart1.View.AxisX.Max = 500
c1Chart1.View.AxisX.MajorUnit = 20
' Financial formatting
C1Chart1.View.AxisX.AnnoFormat = "c"
' axis annotation rotation
C1Chart1.View.AxisX.AnnoAngle = "60"
•C#
// set axes titles
c1Chart1.View.AxisY.Title= new TextBlock() { Text = "Kitchen Electronics" };
c1Chart1.View.AxisX.Title = new TextBlock() { Text = "Price" };
// set axes bounds
c1Chart1.View.AxisX.Min = 0;
c1Chart1.View.AxisX.Max = 500;
c1Chart1.View.AxisX.MajorUnit = 20;
// financial formatting
c1Chart1.View.AxisX.AnnoFormat = "c";
// axis annotation rotation
c1Chart1.View.AxisX.AnnoAngle=60;
In the next step, Step 4 of 4: Adjust the Chart’s Appearance, you’ll learn how to customize the chart’s appearance programmatically.
What You’ve
Accomplished
You have successfully formatted the Chart Axes so when you run your application the new format for the axis annotation is applied to the chart.
In the next step you will apply a theme and palette to C1Chart to adjust its appearance.