Sign in to follow this  
Pallav

Control over Div Line Depth

Recommended Posts

We wanted to show our lines behind the graph(s) but they always showed up on top. So, here are the steps I took to allow for depth management (MSArea2dChart.as).

1) In the chart attribute parsing function add a new param for vDivLineDepth (or whatever you want to call it). I set the available values to TOP and BOTTOM.

2) Create a holder variable (MovieClip). I called it vDivLineHolder.

3) In drawVDivLines, add the following code:

  1. vDivLineHolder = this.cMC.createEmptyMovieClip("vDivLineHolder", this.dm.getDepth("VDIVLINES"));
  2. vDivLineHolder._x = this.elements.canvas.x + this.params.canvasPadding;
  3. vDivLineHolder._y = this.elements.canvas.y;
  4.  
  5. if (this.params.vDivLineDepth.toUpperCase() == "BOTTOM") {
  6.   vDivLineHolder.swapDepths(this.dm.getDepth("DIVLINES")+1);
  7. }else {
  8.     vDivLineHolder.swapDepths(this.lgndMC);
  9. }

This is nothing but a bit of a "hack" to get it to work right. The concept is to add all lines to 1 single parent movieclip vs adding them 1 by 1 to the canvas. There are some other changes that need to be made though.

4) You're going to need to toy with the positioning of the elements. My present source code has numerous other changes so to not confuse I'll leave it as just a notice. Keep in mind you're taking a global x/y value and applying it inside a clip that will start N pixels from the left...just do simple math on it.

5) The last step is in the allotDepths function. Add +1 to the DIVLINES allotment. This way you can swap with that depth (as soon on line 6) which will be empty so you're essentially swapping with nothing.

Line 8 shows you swapping with the legend. It is always going to be on the top of the background anyway so there is no worries of it being too high or too low.

Again, this isn't the absolute best solution but without rewriting a lot of the code this was the best way to meet our needs.

So, to bring this back as a suggestion/request...Fusion, please allow us to control whether the div lines are on top of the graph(s) or behind them.

Thanks.

Share this post


Link to post
Share on other sites

Hi,

 

 

 

If you want to change the depth in code, you can just alter the same in allotDepth() method of the chart class and it'll reflect on the chart.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this