Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Microsoft .Net
 QCChart3D 3D Charting Tools for .Net (VB and C#)
 Z Axis moves when zooming in

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
Jules Posted - 10 Mar 2010 : 18:53:47
Hello,

I've combined both the rotate and zoom examples and I'm having trouble when the user zooms in, the z axis disappears. It is especially noticeable when the user rotates the chart then zooms in.

I have inserted the code below, I haven't been able to find a solution for this. I've noticed there is no SetZoomEnable for the Z Axis, I'm not sure how SetZOrder would be used or whether its the solution to the problem.


If you could point me in the right direction I appreciate it. Thanks for your time.




public partial class ChartControl : ChartView
{
CartesianCoordinates pTransform1;

private class ZoomWithStack : ChartZoom
{

public ZoomWithStack(ChartView component, CartesianCoordinates[] transforms, double zpos, bool brescale) :
base(component, transforms, zpos, brescale)
{
}

public override void OnMouseDown(MouseEventArgs mouseevent)
{
if ((mouseevent.Button & MouseButtons.Right) != 0)
this.PopZoomStack();
else
base.OnMouseDown(mouseevent);
}
}


public ChartControl()
{
// This call is required by the Windows Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitializeComponent call
InitializeChart();
}

private void InitializeChart()
{

// simulate data this

ChartView chartVu = this;

Font theFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);


// data
double[] x1 = { 3.663965161, 7.448755375, 12.63964803, 0.045877066, 12.22243155, 12.03758151, 10.93751714, 12.1850462, 11.71236104, 12.55765871,
9.344306163, 10.43057219, 9.441357613, 12.07729946, 11.15650172, 10.95802909, 13.23384094, 10.67733627, 8.401910124, 11.90250012,
13.36822805, 13.67924775, 8.454798374, 8.9252313, 10.10287334, 6.078430882, 8.22200606, 10.12010426, 8.331029421, 4.1279319, 7.888074115,
8.265128854, 13.61462726, 11.53210752, 12.03464375, 12.22240559, 11.74443608, 11.70036633, 12.93537973 }; double[] y2 = { 1.155201874, 1.897499649, 12.15351368, 0.096716819, 7.99672973, 14.13653452, 10.34433685, 14.8402901, 7.478642319, 9.463070345, 3.594898583, 3.989024011, 5.992580411, 12.86286112, 7.192730009, 6.046422451, 13.14312245, 5.025648839, 7.275951816, 7.138585301, 21.68616996, 18.10968233, 2.17430839, 4.354473244, 8.694826315, 1.756861585, 2.075683806, 4.090638804, 2.098889103, 4.364818816, 1.980662707, 2.101775073, 20.46097867, 6.90107196, 13.8404631, 8.043220362, 11.4239412, 12.12795206, 20.5074413 };
double[] z = { 0.516706475, 3.021865348, 2.758921422, 2.901801, 4.739448596, 2.670990577, 2.673742164, 2.665976454, 2.811158066, 2.907472963, 2.791137629, 2.966415698, 2.726278752, 2.696509958, 2.793537543, 2.829896262, 2.832962902, 2.888497133, 2.88662272, 2.700237519, 2.756739318, 2.939588652, 2.766510203, 2.656128162, 2.672317933, 2.819118092, 2.957987087, 6.06436567, 2.639646455, 2.989303723, 2.707596624, 2.729024113, 2.858482872, 2.68988669, 2.874548514, 2.719381824, 2.669212504, 2.667630788, 5.667630788 };

// dataset for the solutions
SimpleDataset3D Dataset2 = new SimpleDataset3D("Second", x1, y2, z); // 3D


// scale coordinate system for data
SimpleDataset[] datasetarray = { Dataset2 };

pTransform1 = new CartesianCoordinates(ChartObj.LINEAR_SCALE, ChartObj.LINEAR_SCALE);
pTransform1.AutoScale(datasetarray, ChartObj.AUTOAXES_FAR, ChartObj.AUTOAXES_FAR, ChartObj.AUTOAXES_FAR);

// position chart in graph area
pTransform1.SetGraphBorderDiagonal(0.2, .2, .80, 0.725);

// set rotational parameters
pTransform1.AbsRotateCoordinateSystem(new Point3D(10, 15, 0));

// define chart background
Background background = new Background(pTransform1, ChartObj.GRAPH_BACKGROUND, Color.White);
chartVu.AddChartObject(background);

// walls
ChartAttribute wallAttrib = new ChartAttribute(Color.Black, 1, DashStyle.Solid, Color.LightGreen);
Wall3D xyMinZWall = new Wall3D(pTransform1, ChartObj.XY_MAXZ_PLANE, 0.02, wallAttrib);
chartVu.AddChartObject(xyMinZWall);
Wall3D yzMinXWall = new Wall3D(pTransform1, ChartObj.YZ_MINX_PLANE, 0.02, wallAttrib);
chartVu.AddChartObject(yzMinXWall);
Wall3D xzMinYWall = new Wall3D(pTransform1, ChartObj.XZ_MINY_PLANE, 0.02, wallAttrib);
chartVu.AddChartObject(xzMinYWall);

// x-, y-, and z-axes
LinearAxis xAxis = new LinearAxis(pTransform1, ChartObj.X_AXIS);
chartVu.AddChartObject(xAxis);

LinearAxis yAxis = new LinearAxis(pTransform1, ChartObj.Y_AXIS);
chartVu.AddChartObject(yAxis);

LinearAxis zAxis = new LinearAxis(pTransform1, ChartObj.Z_AXIS);
zAxis.AxisIntercept2 = yAxis.AxisMin;
chartVu.AddChartObject(zAxis);

// x-, y-, and z-axis labels
NumericAxisLabels xAxisLab = new NumericAxisLabels(xAxis);
xAxisLab.SetTextFont(theFont);
chartVu.AddChartObject(xAxisLab);

NumericAxisLabels yAxisLab = new NumericAxisLabels(yAxis);
yAxisLab.SetTextFont(theFont);
chartVu.AddChartObject(yAxisLab);

NumericAxisLabels zAxisLab = new NumericAxisLabels(zAxis);
zAxisLab.SetTextFont(theFont);
chartVu.AddChartObject(zAxisLab);

// x-, y-, and z-axis titles
Font titleFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
AxisTitle yaxistitle = new AxisTitle(yAxis, titleFont, "X Axis");
chartVu.AddChartObject(yaxistitle);

AxisTitle xaxistitle = new AxisTitle(xAxis, titleFont, "Y Axis");
chartVu.AddChartObject(xaxistitle);

AxisTitle zaxistitle = new AxisTitle(zAxis, titleFont, "Z Axis");
chartVu.AddChartObject(zaxistitle);

// x-, y-grids
Grid xgrid = new Grid(xAxis, yAxis, ChartObj.X_AXIS, ChartObj.GRID_MAJOR);
chartVu.AddChartObject(xgrid);

Grid ygrid = new Grid(xAxis, yAxis, ChartObj.Y_AXIS, ChartObj.GRID_MAJOR);
chartVu.AddChartObject(ygrid);

Grid zgrid = new Grid(yAxis, zAxis, ChartObj.Z_AXIS, ChartObj.GRID_MAJOR);
chartVu.AddChartObject(zgrid);

// first plot as a simple scatter plot
ChartAttribute attrib1 = new ChartAttribute(Color.Blue, 1, DashStyle.Solid);
attrib1.SetFillColor(Color.Blue);
attrib1.SetFillFlag(true);
attrib1.SetSymbolSize(10);

SimpleScatterPlot thePlot1 = new SimpleScatterPlot(pTransform1, Dataset2, ChartObj.PYRAMID3D, attrib1);
chartVu.AddChartObject(thePlot1);

// legend
Font legendFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
ChartAttribute legendAttributes = new ChartAttribute(Color.Gray, 1, DashStyle.Solid);
legendAttributes.SetFillFlag(false);
legendAttributes.SetLineFlag(false);
StandardLegend legend = new StandardLegend(0.2, 0.875, 0.8, 0.075, legendAttributes, StandardLegend.HORIZ_DIR);
legend.AddLegendItem("Plot 1", thePlot1, legendFont);
legend.SetLegendItemUniformTextColor(Color.Black);
chartVu.AddChartObject(legend);

// title
Font theTitleFont = new Font("Microsoft Sans Serif", 14, FontStyle.Bold);
ChartTitle mainTitle = new ChartTitle(theTitleFont, "Chart Title");
mainTitle.SetTitleType(ChartObj.CHART_HEADER);
mainTitle.SetTitlePosition(ChartObj.CENTER_GRAPH);
chartVu.AddChartObject(mainTitle);

// tooltip
Font toolTipFont = new Font("Microsoft Sans Serif", 10, FontStyle.Regular);
DataToolTip datatooltip = new DataToolTip(chartVu);
NumericLabel xValueTemplate = new NumericLabel(ChartObj.DECIMALFORMAT, 0);
NumericLabel yValueTemplate = new NumericLabel(ChartObj.DECIMALFORMAT, 1);
ChartText textTemplate = new ChartText(toolTipFont, "");
textTemplate.SetTextBgColor(Color.FromArgb(255, 255, 204));
textTemplate.SetTextBgMode(true);
ChartSymbol toolTipSymbol = new ChartSymbol(null, ChartObj.SQUARE, new ChartAttribute(Color.Green));
toolTipSymbol.SetSymbolSize(10.0);
datatooltip.SetTextTemplate(textTemplate);
datatooltip.SetXValueTemplate(xValueTemplate);
datatooltip.SetYValueTemplate(yValueTemplate);
datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_XY_TWOLINE);
datatooltip.SetToolTipSymbol(toolTipSymbol);
datatooltip.SetEnable(true);
chartVu.AddMouseListener(datatooltip);

// rotate mouse listener
RotateChartMouseListener rotateMouseListener = new RotateChartMouseListener(chartVu, MouseButtons.Middle, pTransform1);
rotateMouseListener.SetEnable(true);
chartVu.AddMouseListener(rotateMouseListener);

// zoom
double zpos = 0.0;
CartesianCoordinates[] transformArray = { pTransform1 };
ZoomWithStack zoomObj = new ZoomWithStack(chartVu, transformArray, zpos, true);
zoomObj.SetButtonMask(MouseButtons.Left);
zoomObj.SetZoomYEnable(true);
zoomObj.SetZoomXEnable(true);
zoomObj.SetZoomXRoundMode(ChartObj.AUTOAXES_FAR);
zoomObj.SetZoomYRoundMode(ChartObj.AUTOAXES_FAR);
zoomObj.SetEnable(true);
zoomObj.SetZoomStackEnable(true);
chartVu.SetCurrentMouseListener(zoomObj);

}





}
1   L A T E S T    R E P L I E S    (Newest First)
quinncurtis Posted - 10 Mar 2010 : 19:31:24
What you describe is a bug. The z-axis position is not preserved when zooming in the XY plane.

We will send you a modified QCChart3DNet DLL.

Also, when adding a grid in the XZ plane, use the following code, rather than what is in your example. Note that it specifies all three axes, and sets the GridAxisPlane to XZ_MINY_PLANE.

Grid zgrid = new Grid(xAxis, yAxis, zAxis, ChartObj.Z_AXIS, ChartObj.GRID_MAJOR);
zgrid.GridAxisPlane = ChartObj.XZ_MINY_PLANE;
chartVu.AddChartObject(zgrid);


Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07