Profile Picture

lines and points are drawn out of the box

Posted By bargitta chen 13 Years Ago
Author
Message
bargitta chen
explanationmark Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)Junior Member (18 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 18, Visits: 1
Dear experts,

I always find that lines and points are drawn out of the axis range.
I tried set NStandardScaleConfigurator.RoundToTickMax = true and RoundToTickMin = true.
But it does not work as the attachment.

It is quite urgent, would you please help on that?
Thank you in advance!

Attachments
drawoutside.png (53 views, 96.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

Hi Bargitta,

The log function is not defined for negative values:

http://en.wikipedia.org/wiki/Log_function

You can workaround this if you rescale the data so that it starts from 0 and use custom value formatting. The following code snippet shows how to display data from 0 to 100 scaled as if it was from -50 to 50:

  class CustomValueFormatter : NNumericValueFormatter
  {
   public CustomValueFormatter(double origin)
   {
    m_Origin = origin;
   }
   public override string FormatValue(object value)
   {
    return base.FormatValue((double)value - m_Origin);
   }
   public override string FormatValue(double value)
   {
    return base.FormatValue(value - m_Origin);
   }

   double m_Origin;
  }

  private void Form1_Load(object sender, EventArgs e)
  {
   NChart chart = nChartControl1.Charts[0];

   NLineSeries line = new NLineSeries();
   line.DataLabelStyle.Visible = false;

   line.UseXValues = true;

   for (int i = 0; i < 100; i++)
   {
    line.Values.Add(i);
    line.XValues.Add(i);
   }

   chart.Series.Add(line);

   NLogarithmicScaleConfigurator logScale = new NLogarithmicScaleConfigurator();

   logScale.LabelValueFormatter = new CustomValueFormatter(50);
   chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = logScale;
  }



Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic