Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F946442
Bars.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
Bars.js
View Options
if
(
!
dojo
.
_hasResource
[
"dojox.charting.plot2d.Bars"
]){
//_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo
.
_hasResource
[
"dojox.charting.plot2d.Bars"
]
=
true
;
dojo
.
provide
(
"dojox.charting.plot2d.Bars"
);
dojo
.
require
(
"dojox.charting.plot2d.common"
);
dojo
.
require
(
"dojox.charting.plot2d.Base"
);
dojo
.
require
(
"dojox.lang.utils"
);
dojo
.
require
(
"dojox.lang.functional"
);
(
function
(){
var
df
=
dojox
.
lang
.
functional
,
du
=
dojox
.
lang
.
utils
,
dc
=
dojox
.
charting
.
plot2d
.
common
,
purgeGroup
=
df
.
lambda
(
"item.purgeGroup()"
);
dojo
.
declare
(
"dojox.charting.plot2d.Bars"
,
dojox
.
charting
.
plot2d
.
Base
,
{
defaultParams
:
{
hAxis
:
"x"
,
// use a horizontal axis named "x"
vAxis
:
"y"
,
// use a vertical axis named "y"
gap
:
0
,
// gap between columns in pixels
shadows
:
null
// draw shadows
},
optionalParams
:
{},
// no optional parameters
constructor
:
function
(
chart
,
kwArgs
){
this
.
opt
=
dojo
.
clone
(
this
.
defaultParams
);
du
.
updateWithObject
(
this
.
opt
,
kwArgs
);
this
.
series
=
[];
this
.
hAxis
=
this
.
opt
.
hAxis
;
this
.
vAxis
=
this
.
opt
.
vAxis
;
},
calculateAxes
:
function
(
dim
){
var
stats
=
dc
.
collectSimpleStats
(
this
.
series
),
t
;
stats
.
hmin
-=
0.5
;
stats
.
hmax
+=
0.5
;
t
=
stats
.
hmin
,
stats
.
hmin
=
stats
.
vmin
,
stats
.
vmin
=
t
;
t
=
stats
.
hmax
,
stats
.
hmax
=
stats
.
vmax
,
stats
.
vmax
=
t
;
this
.
_calc
(
dim
,
stats
);
return
this
;
},
render
:
function
(
dim
,
offsets
){
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
.
_vScaler
.
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
);
var
baseline
=
Math
.
max
(
0
,
this
.
_hScaler
.
bounds
.
lower
),
xoff
=
offsets
.
l
+
this
.
_hScaler
.
scale
*
(
baseline
-
this
.
_hScaler
.
bounds
.
lower
),
yoff
=
dim
.
height
-
offsets
.
b
-
this
.
_vScaler
.
scale
*
(
1.5
-
this
.
_vScaler
.
bounds
.
lower
)
+
gap
;
for
(
var
j
=
0
;
j
<
run
.
data
.
length
;
++
j
){
var
v
=
run
.
data
[
j
],
width
=
this
.
_hScaler
.
scale
*
(
v
-
baseline
),
height
=
this
.
_vScaler
.
scale
-
2
*
gap
,
w
=
Math
.
abs
(
width
);
if
(
w
>=
1
&&
height
>=
1
){
var
shape
=
s
.
createRect
({
x
:
xoff
+
(
width
<
0
?
width
:
0
),
y
:
yoff
-
this
.
_vScaler
.
scale
*
j
,
width
:
w
,
height
:
height
}).
setFill
(
fill
).
setStroke
(
stroke
);
run
.
dyn
.
fill
=
shape
.
getFill
();
run
.
dyn
.
stroke
=
shape
.
getStroke
();
}
}
run
.
dirty
=
false
;
}
this
.
dirty
=
false
;
return
this
;
}
});
})();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 06:50 (2 d, 20 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25116
Default Alt Text
Bars.js (2 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment