Dundas Data Visualization SupportYour Partner In Creating Digital Dashboard Solutions
Phone: 416.467.9100  |  support@dundas.com Dundas Support Home  |  Dundas Data Visualization  |  Contact Us

Align multiple chart areas vertically

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Dundas Chart] >> [Support] >> Dundas Chart for ASP.NET >> Align multiple chart areas vertically Page: [1]
Login
Message << Older Topic   Newer Topic >>
Align multiple chart areas vertically - 12/8/2008 11:05:02 AM   
britbunny

 

Posts: 2
Joined: 12/8/2008
Status: offline
Hi,

We've been using Dundas Chart for the last year and we need to align our chart areas.

We are currently displaying 5 individual chart areas (as a line chart), so that we can align the y-axis.
The five charts are displayed in the following orientation (fig 1)

chart1     chart4
chart2     chart5
chart3

We need to display the charts one below the other like (fig2)

chart1
chart2
chart3
chart4
chart5

I have tried using the ChartAreas alignment features to set charts 2-5 to be aligned to chart1 as follows:

Chart.ChartAreas[chart2].AlignWithChartArea = chart1;
Chart.ChartAreas[chart2].AlignType = AreaAlignType.AxesView;
Chart.ChartAreas[chart2].AlignOrientation = AreaAlignOrientation.Vertical;

Chart.ChartAreas[chart3].AlignWithChartArea = chart1;
Chart.ChartAreas[chart3].AlignType = AreaAlignType.AxesView;
Chart.ChartAreas[chart3].AlignOrientation = AreaAlignOrientation.Vertical;

Chart.ChartAreas[chart4].AlignWithChartArea = chart1;
Chart.ChartAreas[chart4].AlignType = AreaAlignType.AxesView;
Chart.ChartAreas[chart4].AlignOrientation = AreaAlignOrientation.Vertical;

Chart.ChartAreas[chart5].AlignWithChartArea = chart1;
Chart.ChartAreas[chart5].AlignType = AreaAlignType.AxesView;
Chart.ChartAreas[chart5].AlignOrientation = AreaAlignOrientation.Vertical;

but output is always the same as what we started with (fig 1).

I'm setting the chart width based on the max number of divisions we have on our x-axis,
and height is based on number of charts x fixed height per chart.

            Chart.Height = 200 * (# of chart areas);
            Chart.Width = 200 * (max # of x axis divisions in a chart area);

If I increase the height of the chart I still get fig 1 output and the charts are just double the height.
Similarly if I increase the width I still get fig 1 output and the charts are double the width.

I've tried aligning chart2 to chart1, chart3 to chart2, chart4 to chart3 and chart5 to chart4 in the hopes that they will all display vertically, but I still get the same results.

Is alignment limited to 2 chart areas?  All the examples I have seen are for only 2 chart areas.

Any help would be appreciated.

Thanks!
Post #: 1
RE: Align multiple chart areas vertically - 12/9/2008 6:59:46 PM   
peterd

 

Posts: 628
Joined: 5/30/2007
Status: offline
Hi,


I took sometime testing this out on my own and I was able to line up the chart areas accordingly. If you are using a version less than 6.2.0.1740 then I would suggest upgrading. To find out what version you have take a look at the following link:
http://support.dundas.com/Default.aspx?article=1069

If you are using the latest version I will have to request a working sample project replicating this issue and then I can take a look at your implementation and try to help you out.

_____________________________

Pete
---------------------------------------------------------------------
Advanced Data Visualization for Microsoft® Technologies
Dundas Software Ltd.
Microsoft Gold Partner - Data Management Solutions
500-250 Ferrand Drive • Toronto, ON • M3C

(in reply to britbunny)
Post #: 2
RE: Align multiple chart areas vertically - 12/10/2008 11:09:25 AM   
britbunny

 

Posts: 2
Joined: 12/8/2008
Status: offline
I have upgraded to the latest version but I still see the same problem.

No matter what height I set the chart area to be it still displays multiple columns.

(in reply to peterd)
Post #: 3
RE: Align multiple chart areas vertically - 12/10/2008 11:12:32 AM   
peterd

 

Posts: 628
Joined: 5/30/2007
Status: offline
Send a sample project (Visual Studio solution) illustrating the issue to support@dundas.com and we'll take a look to see what is going on.



_____________________________

Pete
---------------------------------------------------------------------
Advanced Data Visualization for Microsoft® Technologies
Dundas Software Ltd.
Microsoft Gold Partner - Data Management Solutions
500-250 Ferrand Drive • Toronto, ON • M3C

(in reply to britbunny)
Post #: 4
RE: Align multiple chart areas vertically - 12/18/2008 11:03:01 AM   
peterd

 

Posts: 628
Joined: 5/30/2007
Status: offline
I provided a solution via email and I'll post my reply here for anyone else interested:

The issue was entered in our bug tracking software. However, this in fact is not a bug, but a design decision. The chart control calculates the chart areas based upon a 3x2 matrix, 3 rows x 2 columns. To override this behavior you need to calculation the positions of the ChartAreas in the second row and move them to the first row.

Here is a method created to work around this behavior:
 
       private void ArrangeChartAreas(Chart chart, int columns, int rows)
       {
           if (chart == null || columns < 1 || rows < 1 || chart.ChartAreas.Count == 0)
           {
               throw new ArgumentException("parameter is not valid");
           }

           // margins and gaps
           float topMargin = 3;
           float bottomMargin = 3;
           float verticalGap = 0;

           float leftMargin = 3;
           float rightMargin = 3;
           float horizontalGap = 0;

           // height and width chartarea
           float areaHeight = (100 - topMargin - bottomMargin - (rows - 1) * verticalGap) / rows;
           float areaWidth = (100 - leftMargin - rightMargin - (columns - 1) * horizontalGap) / columns;

           int index = 0;  // chart area index
           for (int column = 0; column < columns; column++)
           {
               for (int row = 0; row < rows; row++)
               {
                   if (index < chart.ChartAreas.Count)
                   {
                       ChartArea area = chart.ChartAreas[index];

                       area.Position.Auto = false;
                       area.Position.Y = areaHeight * row + topMargin + row * verticalGap;
                       area.Position.Height = areaHeight;

                       area.Position.X = areaWidth * column + leftMargin + column * horizontalGap;
                       area.Position.Width = areaWidth;

                       // increment index of chart area
                       index++;
                   }
               }
           }
       }


_____________________________

Pete
---------------------------------------------------------------------
Advanced Data Visualization for Microsoft® Technologies
Dundas Software Ltd.
Microsoft Gold Partner - Data Management Solutions
500-250 Ferrand Drive • Toronto, ON • M3C

(in reply to peterd)
Post #: 5
Page:   [1]
All Forums >> [Dundas Chart] >> [Support] >> Dundas Chart for ASP.NET >> Align multiple chart areas vertically Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts