Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charts
c3-closed
Commits
bae6ab3f
Commit
bae6ab3f
authored
Jun 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'matuszewski-master'
parents
a61e7a79
056c402d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
6 deletions
+17
-6
c3.js
c3.js
+5
-3
c3.min.js
c3.min.js
+0
-0
index.html
htdocs/index.html
+6
-0
chart_bar.html
htdocs/samples/chart_bar.html
+6
-3
No files found.
c3.js
View file @
bae6ab3f
...
...
@@ -253,7 +253,8 @@
// bar
var
__bar_width
=
getConfig
([
'bar'
,
'width'
]),
__bar_width_ratio
=
getConfig
([
'bar'
,
'width'
,
'ratio'
],
0.6
);
__bar_width_ratio
=
getConfig
([
'bar'
,
'width'
,
'ratio'
],
0.6
),
__bar_zerobased
=
getConfig
([
'bar'
,
'zerobased'
],
true
);
// pie
var
__pie_label_show
=
getConfig
([
'pie'
,
'label'
,
'show'
],
true
),
...
...
@@ -1258,6 +1259,7 @@
domainLength
,
padding
,
padding_top
,
padding_bottom
,
center
=
axisId
===
'y2'
?
__axis_y2_center
:
__axis_y_center
,
yDomainAbs
,
lengths
,
diff
,
ratio
,
isAllPositive
,
isAllNegative
,
isZeroBased
=
(
hasBarType
(
yTargets
)
&&
__bar_zerobased
)
||
hasAreaType
(
yTargets
),
showHorizontalDataLabel
=
hasDataLabel
()
&&
__axis_rotated
,
showVerticalDataLabel
=
hasDataLabel
()
&&
!
__axis_rotated
;
if
(
yTargets
.
length
===
0
)
{
// use current domain if target of axisId is none
...
...
@@ -1270,7 +1272,7 @@
isAllNegative
=
yDomainMin
<=
0
&&
yDomainMax
<=
0
;
// Bar/Area chart should be 0-based if all positive|negative
if
(
hasBarType
(
yTargets
)
||
hasAreaType
(
yTargets
)
)
{
if
(
isZeroBased
)
{
if
(
isAllPositive
)
{
yDomainMin
=
0
;
}
if
(
isAllNegative
)
{
yDomainMax
=
0
;
}
}
...
...
@@ -1304,7 +1306,7 @@
padding_bottom
=
getAxisPadding
(
__axis_y2_padding
,
'bottom'
,
padding
,
domainLength
);
}
// Bar/Area chart should be 0-based if all positive|negative
if
(
hasBarType
(
yTargets
)
||
hasAreaType
(
yTargets
)
)
{
if
(
isZeroBased
)
{
if
(
isAllPositive
)
{
padding_bottom
=
yDomainMin
;
}
if
(
isAllNegative
)
{
padding_top
=
-
yDomainMax
;
}
}
...
...
c3.min.js
View file @
bae6ab3f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/index.html
View file @
bae6ab3f
...
...
@@ -313,6 +313,12 @@
Change radius of data point
</a>
</div>
<div
class=
"col-md-4"
>
<h3>
Bar
</h3>
<a
href=
"./samples/bar_zerobased.html"
>
Disable zero-based y domain
</a>
</div>
</div>
</div>
</div>
...
...
htdocs/samples/chart_bar.html
View file @
bae6ab3f
...
...
@@ -11,8 +11,10 @@
var
chart
=
c3
.
generate
({
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
130
,
100
,
140
,
200
,
150
,
50
]
[
'data1'
,
1030
,
1200
,
1100
,
1400
,
1150
,
1250
],
[
'data2'
,
2130
,
2100
,
2140
,
2200
,
2150
,
1850
]
// ['data1', 30, 200, 100, 400, 150, 250],
// ['data2', 130, 100, 140, 200, 150, 50]
],
type
:
'bar'
,
onclick
:
function
(
d
,
element
)
{
console
.
log
(
"onclick"
,
d
,
element
);
},
...
...
@@ -27,7 +29,8 @@
bar
:
{
width
:
{
ratio
:
0.3
}
},
zerobased
:
false
}
});
</script>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment