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

Message ListMessage List     Post MessagePost Message

  absence of makeChart3?
Posted by Thexder HO on Jan-25-2021 15:49
Hi Peter,
I'm using MFC version of ChartDirector,

I found makeChart3 method is absent when I try to do this
code below

XYChart* c = (XYChart*) baseChart->getChart(0)
DrawArea* d  = c->makeChart3() <- here is the missing member prompted when coding, why?

then I tried  DrawArea* d = c->getDreaArea() , and use d->line draw a line,
but nothing happened, go throuth document I found may be it's  possiblly  drawing at the background,

now I'm not sure how to DrawArea to draw a line one the chart dynamically!

please help!

thanks in advance,


  Re: absence of makeChart3?
Posted by Peter Kwan on Jan-25-2021 16:17
Hi Thexder HO,

Sorry for the confusing documentation. The code should be:

DrawArea* d  = c->makeChart()

In the documentation of this API, at the top, there is a section called "Usage". It describes how to call the API, which is makeChart().

(We support many programming languages. So we use a system that can automatically generate and translate the documentation for all programming languages we supported.
However, that system has a limitation that each method must have a different heading. For C++, it supports "overloading", which means multiple methods can have the same name.  So we have to add a number after the method name to make the heading unique.)

Peter Kwan

  Re: absence of makeChart3?
Posted by Thexder HO on Jan-26-2021 06:24
Hi Peter,

thanks for the clarification, I found the solution already,
I tested with initDynamicLayer, it works,  makeChart() works fine too!

I am using removeDynamicLayer() method to remove the Crosshair when mouse leaves the plot area,  but the custom drawing was  removed too!

how can I just remove Crosshair only except the custom drawing.

I put custom drawing method inside drawChart() method, it works fine with viewport sync,
but only thing is when I change the viewport, the custom drawing goes off,
when I move the cursor in the plotarea, the drawing appears once again,

my custom drawing can synchronize with viewport changes perfectly, but only thing is it only appears when mouse moving.

for your reference, the drawChart and OnMouseMovePlotArea both are callng the same custom drawing method, i.e it's a same routine.



  Re: absence of makeChart3?
Posted by Peter Kwan on Jan-28-2021 01:00
Hi Thexder,

Once initDynamicLayer is called, everything drawn on the chart will be on the dynamic layer and will be wiped out next time the initDynamicLayer is called.

You can draw the custom shapes in drawChart before drawing the track cursor. In this way, the custom shapes are not on the dynamic layer and will not be wiped out.

For example, considering the "Zooming and Scroll with Track Line (1)" sample code:

In drawChart, the last few lines are to draw the track cursor, and to display the chart in the CChartViewer. The custom shapes must be drawn before drawing the track cursor. For example:

// Draw custom shape first
DrawArea *d = c->makeChart();
d->circle(100, 100, 50, 50, 0x000000, 0xff0000);

// Original sample code to draw the track cursor
if (!viewer->isInMouseMoveEvent())
    trackLineLegend(c, (0 == viewer->getChart()) ? c->getPlotArea()->getRightX() :

// Original code to display the chart
delete viewer->getChart();

Hope this can help.

Peter Kwan

  Re: absence of makeChart3?
Posted by Thexder HO on Jan-28-2021 07:55
Hi Peter,

thanks again for the help,

now I understand how it works!
it works fine now.