Profile Picture

show Y axis labels shows not the range of labels specified

Posted By Willie-Jan Bons 14 Years Ago

show Y axis labels shows not the range of labels specified

Author
Message
Willie-Jan Bons
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 6, Visits: 1
thanks for your help!

bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Willie,

The problem was generally caused by loss of precision. Float/double numbers are stored in the following format:

(−1)signbit×2exponent× 0.significandbits

which means that not all values representable by a decimal numeric system can be represented by float/double exactly. In the case of the problematic "0" the number 5.5E-17 is actually very close and comes from adding the step several times to the axis origin.

Again this issue is resolved by later versions that use decimal step calculation and produce "exact" decimal results. You can workaround the problem by formatting with limited precision:

value.ToString("0.000;-0.000");

Let me know if you meet any problems...

Best regards,
Bob



Willie-Jan Bons
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 6, Visits: 1

Thanks for your help.

What I do not understand is why the y axis is showing the 5.5E-17 on the axis?
The values are not smaller than 0.0001

When implementing the NCustomValueFormatter i still have to do something otherwise the 5.5E still is shown on the axis.


I am using an older version of the Nevron Chart where the customlabels are not implemented and i need to adjust our (older version) software for a customer.
I can not implement a newer Nevron Chart to our older software version.



bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Willie,

This method for applying axis labels is suitable only for ordinal scales generally. I would recommend using the custom labels feature:

NNumericScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NNumericScaleConfigurator;
scale.AutoLabels =
false;

NCustomValueLabel label = new NCustomValueLabel();
label.Text =
"20";
label.Value = 20;
scale.CustomLabels.Add(label);

or using a custom value formatter:

class NCustomValueFormatter : NValueFormatter
{
public override string FormatValue(object value)
{
return value.ToString();
}
}

private void Form1_Load(object sender, EventArgs e)
{
NChart chart = nChartControl1.Charts[0];
NBarSeries bar = new NBarSeries();
bar.Values.Add(10);
bar.Values.Add(20);
bar.Values.Add(30);
chart.Series.Add(bar);

NNumericScaleConfigurator scale = chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NNumericScaleConfigurator;
scale.LabelValueFormatter =
new NCustomValueFormatter();
}

That is in case you want to change the labels applied to major ticks.

Hope this helps - let me know if you meet any problems.

Best regards,
Bob



Willie-Jan Bons
questionmark Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 6, Visits: 1

I want to show my own labels on the Y-axis.
However it does some strange thing and shows 2 labels in stead of all (see jpg).
What am i doing wrong here?

 

Dim Chart As NChart

Chart = NDSChart.Charts.Item(0)

NDSChart.Legends.Clear()

NDSChart.Settings.RenderDevice = Nevron.GraphicsCore.RenderDevice.GDI

Chart.Projection.ViewerRotation = 0

Dim Ax As NAxis = Nothing

Ax = Chart.Axis(StandardAxis.PrimaryY)

Chart.Axis(Nevron.Chart.StandardAxis.PrimaryX).Visible = True

Chart.Axis(Nevron.Chart.StandardAxis.PrimaryY).Visible = True

Dim NumScaley As New NOrdinalScaleConfigurator

NumScaley.AutoLabels = False

NumScaley.Labels.Clear()

For i As Integer = 1 To 17

NumScaley.Labels.Add(i.ToString)

Next

NumScaley.RoundToTickMax = False

NumScaley.RoundToTickMin = False

Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = NumScaley

Chart.Axis(StandardAxis.PrimaryY).InvalidateScale()

Dim b1 As NLineSeries = Chart.Series.Add(SeriesType.Line)

b1.MarkerStyle.Visible = True

b1.DataLabelStyle.Visible = False

b1.MarkerStyle.PointShape = PointShape.Cross

Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = New NOrdinalScaleConfigurator

If Not IsNothing(Ax) Then

Dim scalex As NStandardScaleConfigurator = Ax.ScaleConfigurator

scalex.MajorGridStyle.LineStyle.Pattern = Nevron.GraphicsCore.LinePattern.Solid

scalex.MajorGridStyle.LineStyle.Width = New Nevron.GraphicsCore.NLength(1)

scalex.MajorGridStyle.LineStyle.Factor = 1

scalex.LabelStyle.Angle = New NScaleLabelAngle(ScaleLabelAngleMode.UseCustomAngle, 0)

End If

Dim P As New NDataPoint(2.84)

b1.AddDataPoint(P)

P = New NDataPoint(2.97)

b1.AddDataPoint(P)

P = New NDataPoint(3.52)

b1.AddDataPoint(P)

P = New NDataPoint(3.4)

b1.AddDataPoint(P)

P = New NDataPoint(4.07)

b1.AddDataPoint(P)

P = New NDataPoint(3.1)

b1.AddDataPoint(P)

P = New NDataPoint(3.23)

b1.AddDataPoint(P)

P = New NDataPoint(2.94)

b1.AddDataPoint(P)

P = New NDataPoint(3.1)

b1.AddDataPoint(P)

P = New NDataPoint(3.23)

b1.AddDataPoint(P)

P = New NDataPoint(2.94)

b1.AddDataPoint(P)

P = New NDataPoint(3.1)

b1.AddDataPoint(P)

P = New NDataPoint(3.22)

b1.AddDataPoint(P)

P = New NDataPoint(3.18)

b1.AddDataPoint(P)

P = New NDataPoint(3.02)

b1.AddDataPoint(P)

P = New NDataPoint(3.62)

b1.AddDataPoint(P)

P = New NDataPoint(3.27)

b1.AddDataPoint(P)

NDSChart.Visible = True

NDSChart.Refresh()



Attachments
nevron.jpg (44 views, 62.00 KB)


Similar Topics


Reading This Topic