Jump to content

Charts: set maximum based on variable


James.LeeDG3.com

Recommended Posts

I have three different stacked bar charts on a page. They all have to compare proportionately. i.e. Barchart A total = 600, Barchart B total = 800 and Barchart C total = 1000. They appear in three different locations, so I cannot make them one bar chart. The information also changes between each record. (comparing 80, 90, and 150 in one, while the next compares 1,000, 2,000, and 5,000 as an example) Therefore, I can't just set up a static maximum.

 

My idea was to have the variable information from the greatest chart (Chart C) appear in a cell that has the visibility set to "hidden" within the lesser charts (Charts A and B). That way the smallest chart is still being drawn with the same maximum as the greatest chart. But I can't find the proper syntax anywhere.

 

Does anybody have some insight?

Link to comment
Share on other sites

I found a quick and dirty fix for this.

 

I created a 4th row of data for the stacked chart that subtracted the largest value of the largest chart from the largest value of the small chart. This created an extra bar stacked on top of the small one, pushing it down to be proportional. Then I set the color to match the background so that it could not be seen.

 

Here's the code:

 

chart = '<row>';

chart += '<cell>' + Field("DataA1");

chart += '<cell>' + Field("DataB1");

chart += '<cell>' + Field("DataC1");

chart += '<cell>' + Field("DataD1");

 

chart += '<row>';

chart += '<cell>' + Field("DataA2");

chart += '<cell>' + Field("DataB2");

chart += '<cell>' + Field("DataC2");

chart += '<cell>' + Field("DataD2");

 

chart += '<row>';

chart += '<cell>' + Field("DataA3small");

chart += '<cell>' + Field("DataB3small");

chart += '<cell>' + Field("DataC3small");

chart += '<cell>' + Field("DataD3small");

 

chart += '<row>';

chart += '<cell>0';

chart += '<cell>0';

chart += '<cell>0';

chart += '<cell>0'+ (StringToNumber(Field("DataD3Large"))-StringToNumber(Field("DataD3small")));;

 

return chart

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...