I am building the xamdatachart axes in the code behind as below:
NumericYAxis yAxis = new NumericYAxis() { IsInverted=true, MajorStrokeThickness= 0 };
NumericYAxis yAxis_right = new NumericYAxis() { IsInverted = false, MajorStrokeThickness = 0 };
To set yAxis's location to OutsideLeft and yAxis_right's location to OutsideRight, I added following part:
yAxis.MinimumValue = 0;
yAxis.Title = "Depth";
yAxis.LabelSettings.Location = AxisLabelsLocation.OutsideLeft;
yAxis_right.MinimumValue = 0;
yAxis_right.Title = "Net Production";
yAxis_right.LabelSettings.Location = AxisLabelsLocation.OutsideRight;
But get error as
"Cannot set a property on object 'Infragistics.Controls.Charts.AxisLabelSettings' because it is in a read-only state."
Any insights on why it happens?
I found this link useful from their website and I did follow the same but I get above error.
Apparently this is a known issue in Xamdatachart. here is the Infragistics's response and workaround to it.
This is essentially due to the AxisLabelSettings object being frozen, and so it gets placed in a read-only state. The workaround to this issue is to create a new AxisLabelSettings object and assign it to your axes' LabelSettings property. You can use the following code for this:
AxisLabelSettings settings = new AxisLabelSettings() { Location = AxisLabelsLocation.OutsideRight };
yAxis.LabelSettings = settings;