Profile Picture

TransformModelToClient sometimes is incorrect when the xaxis scale is...

Posted By Xiaolong Zhu 11 Years Ago

TransformModelToClient sometimes is incorrect when the xaxis scale is...

Author
Message
Xiaolong Zhu
Posted 11 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: 11 Years Ago
Posts: 18, Visits: 1

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;



Nevron Support
Posted 11 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 Xiaolong,

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



Best Regards,
Nevron Support Team



Xiaolong Zhu
Posted 11 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: 11 Years Ago
Posts: 18, Visits: 1

Hi

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

xl





Similar Topics


Reading This Topic