ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  How to click the mouse to rotate 3D Scatter Chart
Posted by liang on May-04-2016 10:06
ASP.NET and Windows Forms How to click the mouse to rotate 3D Scatter Chart?

  Re: How to click the mouse to rotate 3D Scatter Chart
Posted by Peter Kwan on May-05-2016 03:56
Hi Liang,

In ChartDirector, if the chart needs to change, please draw a new chart. For example, in our zooming and scrolling sample code, the charts are scrolled by simply drawing a new chart. You can also rotate a chart by drawing a new chart.

In Windows Forms, you may designed your code like the followings:

(a) Put your charting code in a subroutine. The setViewAngle can be used to configure the angle.

double rotationAngle = 30;
void drawChart()
{
        ThreeDScatterChart *c = new ThreeDScatterChart(....);
        c->setViewAngle(15, rotationAngle);
        .... create the chart as usual ....
}

(b)  When the user clicks on the mouse, you can change the angle and redraw the chart, like:

private void winChartViewer1_Click(object sender, MouseEventArgs e)
{
      rotationAngle = (rotationAngle + 10) % 360;
      drawChart();
}

(c) If instead of using mouse click, you are using some continuous mouse action (eg. mouse move or drag), instead of calling “drawChart” directly in the mouse event handler, you can trigger the viewport change event by calling winChartViewer1.updateViewPort(true, true);. Then in the ViewPortChanged event handler, your code can call drawChart. This is similar to how we implement the zooming and scrolling function in the “Simple Zooming and Scrolling (Windows)” sample code.

For ASP.NET, the method is similar. When the mouse clicks, you can send a request to the server to draw a new chart with an updated angle. You can use AJAX chart update (“partialUpdate” – see the “Simple Zooming and Scrolling (Web)” sample code for an example) if you want the chart to update without refreshing the entire web page.

Regards
Peter Kwan