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

The following code...

<!-- #include file="StackedBarChart.asp" -->
<%
Dim x(11, 2)
x(0, 0) = 22
x(0, 1) = 15
x(0, 2) = 4
x(1, 0) = 17
x(1, 1) = 22
x(1, 2) = 11
x(2, 0) = 3
x(2, 1) = 12
x(2, 2) = 7
x(3, 0) = 13
x(3, 1) = 24
x(3, 2) = 17
x(4, 0) = 23
x(4, 1) = 21
x(4, 2) = 3
x(5, 0) = 34
x(5, 1) = 4
x(5, 2) = 9
x(6, 0) = 12
x(6, 1) = 18
x(6, 2) = 6
x(7, 0) = 9
x(7, 1) = 31
x(7, 2) = 21
x(8, 0) = 29
x(8, 1) = 21
x(8, 2) = 12
x(9, 0) = 22
x(9, 1) = 12
x(9, 2) = 19
x(10, 0) = 22
x(10, 1) = 22
x(10, 2) = 22
x(11, 0) = 19
x(11, 1) = 17
x(11, 2) = 7

y = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
z = Array("East", "South", "West")

StackedBarChart x, y, z, "BgColor:FFFF00;Legend:Y;Dir:F;Show:V;Caption:Sales by Region"

Creates this chart...

Sales by Region
Jan  
22 15 4
Legend
    West
    South
    East
Feb  
17 22 11
Mar  
3 12 7
Apr  
13 24 17
May  
23 21 3
Jun  
34 4 9
Jul  
12 18 6
Aug  
9 31 21
Sep  
29 21 12
Oct  
22 12 19
Nov  
22 22 22
Dec  
19 17 7
  7 14 21 28 35 42 49 56 63 70  


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