Control over Div Line Depth
FusionCharts Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Control over Div Line Depth Expand / Collapse
Author
Message
Posted 2/5/2008 2:06:53 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2/6/2008 1:16:11 PM
Posts: 6, Visits: 6
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.

Post #4393
Posted 2/13/2008 8:18:34 AM
FusionCharts Team

FusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts TeamFusionCharts Team

Group: Administrators
Last Login: 7/2/2008 7:57:52 PM
Posts: 1,956, Visits: 468
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.


Thanks,
Pallav Nadhani
FusionCharts Team
Post #4476
« Prev Topic | Next Topic »


Permissions Expand / Collapse

All times are GMT -7:00, Time now is 7:11am


Execution: 0.063.