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

Message ListMessage List     Post MessagePost Message

  multiple plot areas on a single chart
Posted by BRUNO VOISIN on Nov-07-2023 15:10
Hi,
Is there a way to have several plot areas on a single chart, in order to display additional graphs with the same X axis.  This would look similar to what is available on Finance charts.  Or do I necessarily have to create several charts in the in the same viewer?
Thanks in advance

  Re: multiple plot areas on a single chart
Posted by Peter Kwan on Nov-08-2023 04:24
Hi Bruno,

The only method in ChartDirector is to use a MultiChart. A MultiChart is a container that can contain multiple XYChart objects. The FinanceChart is derived from MultiChart. That's why it can have multiple plot areas.

The following is an example that shows a real-time zoomable MultiChart.

Best Regards
Peter Kwan

  Re: multiple plot areas on a single chart
Posted by BRUNO VOISIN on Nov-08-2023 14:47
Thank you, Peter
I didn't know about the MultiChart feature.
Looking forward to your sample app as I couldn't find one in the demo solution.

  Re: multiple plot areas on a single chart
Posted by Peter Kwan on Nov-09-2023 03:15
Hi BRUNO,

Sorry, I forgot to include the link. It is an example that comes with ChartDirector 7.

https://www.advsofteng.com/doc/cdnet.htm#realtimemultichart.htm

There is another example that is available even in very old versions of ChartDirector. It puts the two XYCharts side by side (instead of top-down):

https://www.advsofteng.com/doc/cdnet.htm#dualhbar.htm

Basically, your code can creates multiple XYChart objects, and then add them to the MultiChart object.


XYChart c1 = new XYChart(.....);
......

XYChart c2 = new XYChart(.....);
......

XYChart c3 = new XYChart(.....);
......


MultiChart m = new MultiChart(totalWidth, totalHeight);

// Add the XYChart objects to the MultiChart at any position you like
m.addChart(x1, y1, c1);
m.addChart(x2, y2, c2);
m.addChart(x3, y3, c3);


// Display the MultiChart
viewer.Chart = m;


Best Regards
Peter Kwan

  Re: multiple plot areas on a single chart
Posted by BRUNO on Nov-10-2023 01:24
Thank you Peter, much appreciated!
Maybe worth adding a "MultiChart" tree node in your sample app for people like me...

Cheers
Bruno