Nevron Forum

TransformModelToClient sometimes is incorrect when the xaxis scale is NValueTimelineScaleConfigurator

https://www.nevron.com/Forum/Topic7600.aspx

By Xiaolong Zhu - Monday, March 18, 2013

Hi experts

When i tries to use the following code to do the transformation from model to client, i found the x value is always wrong. could anybody give any hints? Thanks a lot.

 

public NVector3DF TransformScaleToClient(float scaleX, float scaleY, bool clampToRuler)

{

var xAxis = _chart.Axes[(int)StandardAxis.PrimaryX] as NAxis;

float modelX = xAxis.TransformScaleToModel(clampToRuler, scaleX);

var yAxis = _chart.Axes[(int)StandardAxis.PrimaryY] as NAxis;

float modelY = yAxis.TransformScaleToModel(clampToRuler, scaleY);

var clientVector = new NVector3DF();

_chart.TransformModelToClient(_chartCtrl.View.Context, new NVector3DF(modelX, modelY, 0), ref clientVector);

return clientVector;

}

 

This is the code to configure x axis :

NAxis axisX = _chart.Axes[(int)StandardAxis.PrimaryX] as NAxis;

var dateTimeScale = new NValueTimelineScaleConfigurator();

dateTimeScale.MaxTickCount = 15;

dateTimeScale.Name = "Time";

dateTimeScale.Title.Text = "Time";

dateTimeScale.ViewRangeInflateMode = ScaleViewRangeInflateMode.Absolute;

dateTimeScale.AbsoluteInflate = new NRange1DL(10, 10);

AttachMajorGridToAxis(dateTimeScale);

axisX.ScaleConfigurator = dateTimeScale;

By Nevron Support - Monday, March 18, 2013

Hi Xiaolong,

Can you post the complete code that generates that problem? How do you call TransformScaleToClient in the code below?

By Xiaolong Zhu - Tuesday, March 19, 2013

Hi

Thank you for your reply. i've found the cause which is a typo by mistake.

xl