Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F881098
StackedColumns.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
StackedColumns.js
View Options
if
(
!
dojo
.
_hasResource
[
"dojox.charting.plot2d.StackedColumns"
]){
//_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo
.
_hasResource
[
"dojox.charting.plot2d.StackedColumns"
]
=
true
;
dojo
.
provide
(
"dojox.charting.plot2d.StackedColumns"
);
dojo
.
require
(
"dojox.charting.plot2d.common"
);
dojo
.
require
(
"dojox.charting.plot2d.Columns"
);
dojo
.
require
(
"dojox.lang.functional"
);
(
function
(){
var
df
=
dojox
.
lang
.
functional
,
dc
=
dojox
.
charting
.
plot2d
.
common
,
purgeGroup
=
df
.
lambda
(
"item.purgeGroup()"
);
dojo
.
declare
(
"dojox.charting.plot2d.StackedColumns"
,
dojox
.
charting
.
plot2d
.
Columns
,
{
calculateAxes
:
function
(
dim
){
var
stats
=
dc
.
collectStackedStats
(
this
.
series
);
this
.
_maxRunLength
=
stats
.
hmax
;
stats
.
hmin
-=
0.5
;
stats
.
hmax
+=
0.5
;
this
.
_calc
(
dim
,
stats
);
return
this
;
},
render
:
function
(
dim
,
offsets
){
// stack all values
var
acc
=
df
.
repeat
(
this
.
_maxRunLength
,
"-> 0"
,
0
);
for
(
var
i
=
0
;
i
<
this
.
series
.
length
;
++
i
){
var
run
=
this
.
series
[
i
];
for
(
var
j
=
0
;
j
<
run
.
data
.
length
;
++
j
){
var
v
=
run
.
data
[
j
];
if
(
isNaN
(
v
)){
v
=
0
;
}
acc
[
j
]
+=
v
;
}
}
// draw runs in backwards
if
(
this
.
dirty
){
dojo
.
forEach
(
this
.
series
,
purgeGroup
);
this
.
cleanGroup
();
var
s
=
this
.
group
;
df
.
forEachReversed
(
this
.
series
,
function
(
item
){
item
.
cleanGroup
(
s
);
});
}
var
t
=
this
.
chart
.
theme
,
color
,
stroke
,
fill
,
f
,
gap
=
this
.
opt
.
gap
<
this
.
_hScaler
.
scale
/
3
?
this
.
opt
.
gap
:
0
;
for
(
var
i
=
this
.
series
.
length
-
1
;
i
>=
0
;
--
i
){
var
run
=
this
.
series
[
i
];
if
(
!
this
.
dirty
&&
!
run
.
dirty
){
continue
;
}
run
.
cleanGroup
();
var
s
=
run
.
group
;
if
(
!
run
.
fill
||
!
run
.
stroke
){
// need autogenerated color
color
=
run
.
dyn
.
color
=
new
dojo
.
Color
(
t
.
next
(
"color"
));
}
stroke
=
run
.
stroke
?
run
.
stroke
:
dc
.
augmentStroke
(
t
.
series
.
stroke
,
color
);
fill
=
run
.
fill
?
run
.
fill
:
dc
.
augmentFill
(
t
.
series
.
fill
,
color
);
for
(
var
j
=
0
;
j
<
acc
.
length
;
++
j
){
var
v
=
acc
[
j
],
width
=
this
.
_hScaler
.
scale
-
2
*
gap
,
height
=
this
.
_vScaler
.
scale
*
(
v
-
this
.
_vScaler
.
bounds
.
lower
);
if
(
width
>=
1
&&
height
>=
1
){
var
shape
=
s
.
createRect
({
x
:
offsets
.
l
+
this
.
_hScaler
.
scale
*
(
j
+
0.5
-
this
.
_hScaler
.
bounds
.
lower
)
+
gap
,
y
:
dim
.
height
-
offsets
.
b
-
this
.
_vScaler
.
scale
*
(
v
-
this
.
_vScaler
.
bounds
.
lower
),
width
:
width
,
height
:
height
}).
setFill
(
fill
).
setStroke
(
stroke
);
run
.
dyn
.
fill
=
shape
.
getFill
();
run
.
dyn
.
stroke
=
shape
.
getStroke
();
}
}
run
.
dirty
=
false
;
// update the accumulator
for
(
var
j
=
0
;
j
<
run
.
data
.
length
;
++
j
){
var
v
=
run
.
data
[
j
];
if
(
isNaN
(
v
)){
v
=
0
;
}
acc
[
j
]
-=
v
;
}
}
this
.
dirty
=
false
;
return
this
;
}
});
})();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Apr 2 2025, 03:17 (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26696
Default Alt Text
StackedColumns.js (2 KB)
Attached To
rZEDHG ZedLegacy
Event Timeline
Log In to Comment