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

Message ListMessage List     Post MessagePost Message

  Remove chart Y axis
Posted by abhishek.mr on Apr-27-2018 22:03
Hi,

Is there any possibility to remove chart y axis dynamically ?


Regards,
Abhishek

  Re: Remove chart Y axis
Posted by Peter Kwan on Apr-28-2018 00:54
Hi abhishek,

You can set the y-axis to be transparent. For example, in C#:

c.yAxis().setColors(Chart.Transparent, Chart.Transparent);

Hope this can help.

Regards
Peter Kwan

  Re: Remove chart Y axis
Posted by abhishek.mr on Apr-28-2018 15:52
Hello Peter,

Yes this would help for me in case of single Y-Axis in the chart.

1. But in case of my scenario, I have a chart with 6 Y-Axis (perhaps it is dynamic), whereas the chart need to add/remove the Y axis dynamically based on some condition.

On our analysis there is no way to get the axis list from the Chart class or somewhere.

Is there any API to remove the Y-Axis dynamically in program?

2. Same case for add/remove line layer also

Hope my queries is clear for you. Thanks for the help in advance.

Regards,
Abhishek MR

  Re: Remove chart Y axis
Posted by Peter Kwan on Apr-30-2018 17:32
Hi abhishek.mr,

ChartDirector includes an example called "Interactive Financial Chart". This is a chart where the user can add/remove line layers, as well as many other features on the chart. You can use the same method to add/remove y-axis as well.

I am not sure which programming language edition of ChartDirector you are using. The following link is the sample code in C++ edition of ChartDirector.

http://www.advsofteng.com/doc/cdcpp.htm#financedemo.htm

In brief, when you draw the chart, you may add the line layers or axes based on some conditions. So the code structure is like:


void drawChart()
{
     XYChart *c = new XYChart(....);
     ......

     if (some_condition)
     {
         ... code to add a line layer ....
     }

     if (some_condition)
     {
         ... code to add another line layer ....
     }

     if (some_condition)
     {
         ... code to add an axis ...
     }

     .....

     ..... finally display the chart .....
}


When the condition changes (such as the user clicked on a checkbox), your code just need to call "drawChart" again to update the chart. In short, no matter what the user has changed, you just call "drawChart". No other code is needed.


Hope this can help.

Regards
Peter Kwan