Professional Computing Solutions, Inc.
Example -- Stacked100BarChart
A 100% stacked bar chart allows you to specify values for individual categories and then display what percentage those values comprise of the total value of all categories combined.  The chart elements are displayed as horizontal bars.  The example below shows the percentage of sales made by stores in individual regions as they contribute to the total company sales.
Go Back

The following code...

<!-- #include file="Stacked100BarChart.asp" -->

<%
Dim x(11, 2)
Dim optList
x(0, 0) = 2200
x(0, 1) = 1500
x(0, 2) = 4000

x(1, 0) = 1700
x(1, 1) = 2200
x(1, 2) = 1100

x(2, 0) = 3000
x(2, 1) = 1200
x(2, 2) = 700

x(3, 0) = 1300
x(3, 1) = 2400
x(3, 2) = 1700

x(4, 0) = 2300
x(4, 1) = 2100
x(4, 2) = 300

x(5, 0) = 3400
x(5, 1) = 400
x(5, 2) = 900

x(6, 0) = 1200
x(6, 1) = 1800
x(6, 2) = 600

x(7, 0) = 900
x(7, 1) = 3100
x(7, 2) = 2100

x(8, 0) = 2900
x(8, 1) = 2100
x(8, 2) = 1200

x(9, 0) = 2200
x(9, 1) = 1200
x(9, 2) = 1900

x(10, 0) = 2200
x(10, 1) = 2200
x(10, 2) = 2200

x(11, 0) = 1900
x(11, 1) = 1700
x(11, 2) = 700

y = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
z = Array("East", "South", "West")
optList = "BgColor:008080;Legend:Y;Show:V;Dir:F;FormatValue:$;LabelFontFace:Arial;" & _
          "BarFontFace:Tahoma;LabelFontSize:2;RegKey:111-XXX-222;" & _ 
          "Caption:Sales by Region;PlotColor:0000FF;LabelColor:FFFF00"

Stacked100BarChart x, y, z, optList

Creates this chart...
Sales by Region
Jan  
$2200
$1500
$4000
Legend
    South
    North
    East
Feb  
$1700
$2200
$1100
Mar  
$3000
$1200
$700
Apr  
$1300
$2400
$1700
May  
$2300
$2100
$300
Jun  
$3400
$400
$900
Jul  
$1200
$1800
$600
Aug  
$900
$3100
$2100
Sep  
$2900
$2100
$1200
Oct  
$2200
$1200
$1900
Nov  
$2200
$2200
$2200
Dec  
$1900
$1700
$700
 
10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
 

Example -- Stacked100BarChartHREF
New in WebCharts Pro!  Creates the same high-quality stacked 100% bar chart, but allows the series within the bars to be hyper linked to other web pages.  Each individual series within each bar can be linked to a separate page.

The following code...

<!-- #include file="Stacked100BarChart.asp" -->
<%
Dim x(11, 2)

x(0, 0) = 2200
x(0, 1) = 1500
x(0, 2) = 4000

x(1, 0) = 1700
x(1, 1) = 2200
x(1, 2) = 1100

x(2, 0) = 3000
x(2, 1) = 1200
x(2, 2) = 700

x(3, 0) = 1300
x(3, 1) = 2400
x(3, 2) = 1700

x(4, 0) = 2300
x(4, 1) = 2100
x(4, 2) = 300

x(5, 0) = 3400
x(5, 1) = 400
x(5, 2) = 900

x(6, 0) = 1200
x(6, 1) = 1800
x(6, 2) = 600

x(7, 0) = 900
x(7, 1) = 3100
x(7, 2) = 2100

x(8, 0) = 2900
x(8, 1) = 2100
x(8, 2) = 1200

x(9, 0) = 2200
x(9, 1) = 1200
x(9, 2) = 1900

x(10, 0) = 2200
x(10, 1) = 2200
x(10, 2) = 2200

x(11, 0) = 1900
x(11, 1) = 1700
x(11, 2) = 700

Dim hrefList2(11, 2)
hrefList2(0, 0) = "details.asp?MTH=0&REG=East"
hrefList2(0, 1) = "details.asp?MTH=0&REG=North"
hrefList2(0, 2) = "details.asp?MTH=0&REG=South"

hrefList2(1, 0) = "details.asp?MTH=1&REG=East"
hrefList2(1, 1) = "details.asp?MTH=1&REG=North"
hrefList2(1, 2) = "details.asp?MTH=1&REG=South"

hrefList2(2, 0) = "details.asp?MTH=2&REG=East"
hrefList2(2, 1) = "details.asp?MTH=2&REG=North"
hrefList2(2, 2) = "details.asp?MTH=2&REG=South"

hrefList2(3, 0) = "details.asp?MTH=3&REG=East"
hrefList2(3, 1) = "details.asp?MTH=3&REG=North"
hrefList2(3, 2) = "details.asp?MTH=3&REG=South"

hrefList2(4, 0) = "details.asp?MTH=4&REG=East"
hrefList2(4, 1) = "details.asp?MTH=4&REG=North"
hrefList2(4, 2) = "details.asp?MTH=4&REG=South"

hrefList2(5, 0) = "details.asp?MTH=5&REG=East"
hrefList2(5, 1) = "details.asp?MTH=5&REG=North"
hrefList2(5, 2) = "details.asp?MTH=5&REG=South"

hrefList2(6, 0) = "details.asp?MTH=6&REG=East"
hrefList2(6, 1) = "details.asp?MTH=6&REG=North"
hrefList2(6, 2) = "details.asp?MTH=6&REG=South"

hrefList2(7, 0) = "details.asp?MTH=7&REG=East"
hrefList2(7, 1) = "details.asp?MTH=7&REG=North"
hrefList2(7, 2) = "details.asp?MTH=7&REG=South"

hrefList2(8, 0) = "details.asp?MTH=8&REG=East"
hrefList2(8, 1) = "details.asp?MTH=8&REG=North"
hrefList2(8, 2) = "details.asp?MTH=8&REG=South"

hrefList2(9, 0) = "details.asp?MTH=9&REG=East"
hrefList2(9, 1) = "details.asp?MTH=9&REG=North"
hrefList2(9, 2) = "details.asp?MTH=9&REG=South"

hrefList2(10, 0) = "details.asp?MTH=10&REG=East"
hrefList2(10, 1) = "details.asp?MTH=10&REG=North"
hrefList2(10, 2) = "details.asp?MTH=10&REG=South"

hrefList2(11, 0) = "details.asp?MTH=11&REG=East"
hrefList2(11, 1) = "details.asp?MTH=11&REG=North"
hrefList2(11, 2) = "details.asp?MTH=11&REG=South"

y = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
z = Array("East", "South", "West")
optList = "BgColor:008080;Legend:Y;Show:V;Dir:F;FormatValue:$;LabelFontFace:Arial;" & _
          "BarFontFace:Tahoma;LabelFontSize:2;RegKey:111-XXX-222;" & _ 
          "Caption:Sales by Region;PlotColor:0000FF;LabelColor:FFFF00"

Stacked100BarChartHREF x, y, z, hrefList, optList

Creates this chart...
Sales by Region
Jan  
$2200
$1500
$4000
Legend
    South
    North
    East
Feb  
$1700
$2200
$1100
Mar  
$3000
$1200
$700
Apr  
$1300
$2400
$1700
May  
$2300
$2100
$300
Jun  
$3400
$400
$900
Jul  
$1200
$1800
$600
Aug  
$900
$3100
$2100
Sep  
$2900
$2100
$1200
Oct  
$2200
$1200
$1900
Nov  
$2200
$2200
$2200
Dec  
$1900
$1700
$700
 
10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
 


Send comments or questions on this page to webmaster@thePCSweb.com
Copyright © 1999-2008 Professional Computing Solutions, Inc.