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
Evgeny
c3-closed
Commits
cdecc19f
Commit
cdecc19f
authored
Jun 06, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Fix conflict
parents
56092012
0bc9ce15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
6 deletions
+48
-6
c3.js
c3.js
+24
-3
c3.min.js
c3.min.js
+0
-0
data.convert.js
src/data.convert.js
+23
-2
text.js
src/text.js
+1
-1
No files found.
c3.js
View file @
cdecc19f
...
@@ -2066,8 +2066,12 @@
...
@@ -2066,8 +2066,12 @@
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
ids
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isNotX
,
$$
),
ids
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isNotX
,
$$
),
xs
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isX
,
$$
),
xs
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isX
,
$$
),
zeroUnderYAxis
=
true
,
allZero
=
true
,
targets
;
targets
;
$$
.
allDataIsNegative
=
true
;
// save x for update data by load when custom x and c3.x API
// save x for update data by load when custom x and c3.x API
ids
.
forEach
(
function
(
id
)
{
ids
.
forEach
(
function
(
id
)
{
var
xKey
=
$$
.
getXKey
(
id
);
var
xKey
=
$$
.
getXKey
(
id
);
...
@@ -2110,7 +2114,9 @@
...
@@ -2110,7 +2114,9 @@
id
:
convertedId
,
id
:
convertedId
,
id_org
:
id
,
id_org
:
id
,
values
:
data
.
map
(
function
(
d
,
i
)
{
values
:
data
.
map
(
function
(
d
,
i
)
{
var
xKey
=
$$
.
getXKey
(
id
),
rawX
=
d
[
xKey
],
x
=
$$
.
generateTargetX
(
rawX
,
id
,
i
);
var
xKey
=
$$
.
getXKey
(
id
),
rawX
=
d
[
xKey
],
x
=
$$
.
generateTargetX
(
rawX
,
id
,
i
),
value
=
d
[
id
]
!==
null
&&
!
isNaN
(
d
[
id
])
?
+
d
[
id
]
:
null
;
// use x as categories if custom x and categorized
// use x as categories if custom x and categorized
if
(
$$
.
isCustomX
()
&&
$$
.
isCategorized
()
&&
index
===
0
&&
rawX
)
{
if
(
$$
.
isCustomX
()
&&
$$
.
isCategorized
()
&&
index
===
0
&&
rawX
)
{
if
(
i
===
0
)
{
config
.
axis_x_categories
=
[];
}
if
(
i
===
0
)
{
config
.
axis_x_categories
=
[];
}
...
@@ -2120,7 +2126,16 @@
...
@@ -2120,7 +2126,16 @@
if
(
isUndefined
(
d
[
id
])
||
$$
.
data
.
xs
[
id
].
length
<=
i
)
{
if
(
isUndefined
(
d
[
id
])
||
$$
.
data
.
xs
[
id
].
length
<=
i
)
{
x
=
undefined
;
x
=
undefined
;
}
}
return
{
x
:
x
,
value
:
d
[
id
]
!==
null
&&
!
isNaN
(
d
[
id
])
?
+
d
[
id
]
:
null
,
id
:
convertedId
};
if
(
value
!==
null
&&
value
!==
0
)
{
allZero
=
false
;
}
if
(
value
>
0
)
{
zeroUnderYAxis
=
false
;
}
return
{
x
:
x
,
value
:
value
,
id
:
convertedId
};
}).
filter
(
function
(
v
)
{
return
isDefined
(
v
.
x
);
})
}).
filter
(
function
(
v
)
{
return
isDefined
(
v
.
x
);
})
};
};
});
});
...
@@ -2147,6 +2162,12 @@
...
@@ -2147,6 +2162,12 @@
});
});
});
});
if
(
allZero
)
{
zeroUnderYAxis
=
false
;
}
$$
.
zeroUnderYAxis
=
zeroUnderYAxis
;
// set target types
// set target types
if
(
config
.
data_type
)
{
if
(
config
.
data_type
)
{
$$
.
setTargetType
(
$$
.
mapToIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
config
.
data_types
);
}),
config
.
data_type
);
$$
.
setTargetType
(
$$
.
mapToIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
config
.
data_types
);
}),
config
.
data_type
);
...
@@ -3387,7 +3408,7 @@
...
@@ -3387,7 +3408,7 @@
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
}
else
{
}
else
{
yPos
=
points
[
2
][
1
];
yPos
=
points
[
2
][
1
];
if
(
d
.
value
<
0
)
{
if
(
d
.
value
<
0
||
(
d
.
value
===
0
&&
$$
.
zeroUnderYAxis
)
)
{
yPos
+=
box
.
height
;
yPos
+=
box
.
height
;
if
(
$$
.
isBarType
(
d
)
&&
$$
.
isSafari
())
{
if
(
$$
.
isBarType
(
d
)
&&
$$
.
isSafari
())
{
yPos
-=
3
;
yPos
-=
3
;
...
...
c3.min.js
View file @
cdecc19f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/data.convert.js
View file @
cdecc19f
...
@@ -96,8 +96,12 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
...
@@ -96,8 +96,12 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
ids
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isNotX
,
$$
),
ids
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isNotX
,
$$
),
xs
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isX
,
$$
),
xs
=
$$
.
d3
.
keys
(
data
[
0
]).
filter
(
$$
.
isX
,
$$
),
zeroUnderYAxis
=
true
,
allZero
=
true
,
targets
;
targets
;
$$
.
allDataIsNegative
=
true
;
// save x for update data by load when custom x and c3.x API
// save x for update data by load when custom x and c3.x API
ids
.
forEach
(
function
(
id
)
{
ids
.
forEach
(
function
(
id
)
{
var
xKey
=
$$
.
getXKey
(
id
);
var
xKey
=
$$
.
getXKey
(
id
);
...
@@ -140,7 +144,9 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
...
@@ -140,7 +144,9 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
id
:
convertedId
,
id
:
convertedId
,
id_org
:
id
,
id_org
:
id
,
values
:
data
.
map
(
function
(
d
,
i
)
{
values
:
data
.
map
(
function
(
d
,
i
)
{
var
xKey
=
$$
.
getXKey
(
id
),
rawX
=
d
[
xKey
],
x
=
$$
.
generateTargetX
(
rawX
,
id
,
i
);
var
xKey
=
$$
.
getXKey
(
id
),
rawX
=
d
[
xKey
],
x
=
$$
.
generateTargetX
(
rawX
,
id
,
i
),
value
=
d
[
id
]
!==
null
&&
!
isNaN
(
d
[
id
])
?
+
d
[
id
]
:
null
;
// use x as categories if custom x and categorized
// use x as categories if custom x and categorized
if
(
$$
.
isCustomX
()
&&
$$
.
isCategorized
()
&&
index
===
0
&&
rawX
)
{
if
(
$$
.
isCustomX
()
&&
$$
.
isCategorized
()
&&
index
===
0
&&
rawX
)
{
if
(
i
===
0
)
{
config
.
axis_x_categories
=
[];
}
if
(
i
===
0
)
{
config
.
axis_x_categories
=
[];
}
...
@@ -150,7 +156,16 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
...
@@ -150,7 +156,16 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
if
(
isUndefined
(
d
[
id
])
||
$$
.
data
.
xs
[
id
].
length
<=
i
)
{
if
(
isUndefined
(
d
[
id
])
||
$$
.
data
.
xs
[
id
].
length
<=
i
)
{
x
=
undefined
;
x
=
undefined
;
}
}
return
{
x
:
x
,
value
:
d
[
id
]
!==
null
&&
!
isNaN
(
d
[
id
])
?
+
d
[
id
]
:
null
,
id
:
convertedId
};
if
(
value
!==
null
&&
value
!==
0
)
{
allZero
=
false
;
}
if
(
value
>
0
)
{
zeroUnderYAxis
=
false
;
}
return
{
x
:
x
,
value
:
value
,
id
:
convertedId
};
}).
filter
(
function
(
v
)
{
return
isDefined
(
v
.
x
);
})
}).
filter
(
function
(
v
)
{
return
isDefined
(
v
.
x
);
})
};
};
});
});
...
@@ -177,6 +192,12 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
...
@@ -177,6 +192,12 @@ c3_chart_internal_fn.convertDataToTargets = function (data, appendXs) {
});
});
});
});
if
(
allZero
)
{
zeroUnderYAxis
=
false
;
}
$$
.
zeroUnderYAxis
=
zeroUnderYAxis
;
// set target types
// set target types
if
(
config
.
data_type
)
{
if
(
config
.
data_type
)
{
$$
.
setTargetType
(
$$
.
mapToIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
config
.
data_types
);
}),
config
.
data_type
);
$$
.
setTargetType
(
$$
.
mapToIds
(
targets
).
filter
(
function
(
id
)
{
return
!
(
id
in
config
.
data_types
);
}),
config
.
data_type
);
...
...
src/text.js
View file @
cdecc19f
...
@@ -98,7 +98,7 @@ c3_chart_internal_fn.getYForText = function (points, d, textElement) {
...
@@ -98,7 +98,7 @@ c3_chart_internal_fn.getYForText = function (points, d, textElement) {
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
yPos
=
(
points
[
0
][
0
]
+
points
[
2
][
0
]
+
box
.
height
*
0.6
)
/
2
;
}
else
{
}
else
{
yPos
=
points
[
2
][
1
];
yPos
=
points
[
2
][
1
];
if
(
d
.
value
<
0
)
{
if
(
d
.
value
<
0
||
(
d
.
value
===
0
&&
$$
.
zeroUnderYAxis
)
)
{
yPos
+=
box
.
height
;
yPos
+=
box
.
height
;
if
(
$$
.
isBarType
(
d
)
&&
$$
.
isSafari
())
{
if
(
$$
.
isBarType
(
d
)
&&
$$
.
isSafari
())
{
yPos
-=
3
;
yPos
-=
3
;
...
...
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