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
2fa6a3b5
Commit
2fa6a3b5
authored
Aug 16, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove isFunction
parent
248324db
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
52 additions
and
84 deletions
+52
-84
c3.js
c3.js
+26
-42
c3.min.js
c3.min.js
+0
-0
api.js
src/api.js
+1
-1
axis.js
src/axis.js
+1
-1
core.js
src/core.js
+16
-28
data.load.js
src/data.load.js
+2
-4
format.js
src/format.js
+2
-2
legend.js
src/legend.js
+3
-3
scale.js
src/scale.js
+1
-3
No files found.
c3.js
View file @
2fa6a3b5
...
@@ -134,9 +134,9 @@
...
@@ -134,9 +134,9 @@
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
main
,
eventRect
,
binding
=
true
;
var
main
,
eventRect
,
binding
=
true
;
if
(
isFunction
(
$$
.
initPie
)
)
{
$$
.
initPie
();
}
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
isFunction
(
$$
.
initBrush
)
)
{
$$
.
initBrush
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
if
(
isFunction
(
$$
.
initZoom
)
)
{
$$
.
initZoom
();
}
if
(
$$
.
initZoom
)
{
$$
.
initZoom
();
}
$$
.
selectChart
=
d3
.
select
(
config
[
__bindto
]);
$$
.
selectChart
=
d3
.
select
(
config
[
__bindto
]);
if
(
$$
.
selectChart
.
empty
())
{
if
(
$$
.
selectChart
.
empty
())
{
...
@@ -201,9 +201,9 @@
...
@@ -201,9 +201,9 @@
// Define regions
// Define regions
main
=
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'main'
));
main
=
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'main'
));
if
(
isFunction
(
$$
.
initSubchart
)
)
{
$$
.
initSubchart
();
}
if
(
$$
.
initSubchart
)
{
$$
.
initSubchart
();
}
if
(
isFunction
(
$$
.
initTooltip
)
)
{
$$
.
initTooltip
();
}
if
(
$$
.
initTooltip
)
{
$$
.
initTooltip
();
}
if
(
isFunction
(
$$
.
initLegend
)
)
{
$$
.
initLegend
();
}
if
(
$$
.
initLegend
)
{
$$
.
initLegend
();
}
/*-- Main Region --*/
/*-- Main Region --*/
...
@@ -240,12 +240,8 @@
...
@@ -240,12 +240,8 @@
.
attr
(
"class"
,
CLASS
[
_chartLines
]);
.
attr
(
"class"
,
CLASS
[
_chartLines
]);
// Define g for arc chart area
// Define g for arc chart area
if
(
isFunction
(
$$
.
initArc
))
{
if
(
$$
.
initArc
)
{
$$
.
initArc
();
}
$$
.
initArc
();
if
(
$$
.
initGauge
)
{
$$
.
initGauge
();
}
}
if
(
isFunction
(
$$
.
initGauge
))
{
$$
.
initGauge
();
}
main
.
select
(
'.'
+
CLASS
[
_chart
]).
append
(
"g"
)
main
.
select
(
'.'
+
CLASS
[
_chart
]).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_chartTexts
]);
.
attr
(
"class"
,
CLASS
[
_chartTexts
]);
...
@@ -261,7 +257,7 @@
...
@@ -261,7 +257,7 @@
// Set default extent if defined
// Set default extent if defined
if
(
config
[
__axis_x_default
])
{
if
(
config
[
__axis_x_default
])
{
$$
.
brush
.
extent
(
!
isFunction
(
config
[
__axis_x_default
])
?
config
[
__axis_x_default
]
:
config
[
__axis_x_default
](
$$
.
getXDomain
())
);
$$
.
brush
.
extent
(
isFunction
(
config
[
__axis_x_default
])
?
config
[
__axis_x_default
](
$$
.
getXDomain
())
:
config
[
__axis_x_default
]
);
}
}
// Add Axis
// Add Axis
...
@@ -363,7 +359,7 @@
...
@@ -363,7 +359,7 @@
}
}
// for legend
// for legend
if
(
isFunction
(
$$
.
updateSizeForLegend
)
)
{
$$
.
updateSizeForLegend
(
legendHeight
,
legendWidth
);
}
if
(
$$
.
updateSizeForLegend
)
{
$$
.
updateSizeForLegend
(
legendHeight
,
legendWidth
);
}
$$
.
width
=
$$
.
currentWidth
-
$$
.
margin
.
left
-
$$
.
margin
.
right
;
$$
.
width
=
$$
.
currentWidth
-
$$
.
margin
.
left
-
$$
.
margin
.
right
;
$$
.
height
=
$$
.
currentHeight
-
$$
.
margin
.
top
-
$$
.
margin
.
bottom
;
$$
.
height
=
$$
.
currentHeight
-
$$
.
margin
.
top
-
$$
.
margin
.
bottom
;
...
@@ -378,9 +374,7 @@
...
@@ -378,9 +374,7 @@
// for arc
// for arc
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
if
(
isFunction
(
$$
.
updateRadius
))
{
if
(
$$
.
updateRadius
)
{
$$
.
updateRadius
();
}
$$
.
updateRadius
();
}
if
(
$$
.
isLegendRight
&&
hasArc
)
{
if
(
$$
.
isLegendRight
&&
hasArc
)
{
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
...
@@ -446,12 +440,8 @@
...
@@ -446,12 +440,8 @@
// MEMO: can not keep same color...
// MEMO: can not keep same color...
//mainLineUpdate.exit().remove();
//mainLineUpdate.exit().remove();
if
(
isFunction
(
$$
.
updateTargetsForArc
))
{
if
(
$$
.
updateTargetsForArc
)
{
$$
.
updateTargetsForArc
(
targets
);
}
$$
.
updateTargetsForArc
(
targets
);
if
(
$$
.
updateTargetsForSubchart
)
{
$$
.
updateTargetsForSubchart
(
targets
);
}
}
if
(
isFunction
(
$$
.
updateTargetsForSubchart
))
{
$$
.
updateTargetsForSubchart
(
targets
);
}
/*-- Show --*/
/*-- Show --*/
...
@@ -658,12 +648,10 @@
...
@@ -658,12 +648,10 @@
}
}
// arc
// arc
if
(
isFunction
(
$$
.
redrawArc
))
{
if
(
$$
.
redrawArc
)
{
$$
.
redrawArc
(
duration
,
durationForExit
,
withTransform
);
}
$$
.
redrawArc
(
duration
,
durationForExit
,
withTransform
);
}
// subchart
// subchart
if
(
isFunction
(
$$
.
redrawSubchart
)
)
{
if
(
$$
.
redrawSubchart
)
{
$$
.
redrawSubchart
(
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
);
$$
.
redrawSubchart
(
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
);
}
}
...
@@ -911,7 +899,7 @@
...
@@ -911,7 +899,7 @@
$$
.
withoutFadeIn
[
id
]
=
true
;
$$
.
withoutFadeIn
[
id
]
=
true
;
});
});
if
(
isFunction
(
$$
.
updateZoom
)
)
{
$$
.
updateZoom
();
}
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
};
};
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
...
@@ -1842,9 +1830,7 @@
...
@@ -1842,9 +1830,7 @@
if
(
config
[
__zoom_enabled
])
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
if
(
config
[
__zoom_enabled
])
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
}
}
// update for arc
// update for arc
if
(
isFunction
(
$$
.
updateArc
))
{
if
(
$$
.
updateArc
)
{
$$
.
updateArc
();
}
$$
.
updateArc
();
}
};
};
c3_chart_internal_fn
.
getYDomainMin
=
function
(
targets
)
{
c3_chart_internal_fn
.
getYDomainMin
=
function
(
targets
)
{
...
@@ -2579,9 +2565,7 @@
...
@@ -2579,9 +2565,7 @@
// Redraw with new targets
// Redraw with new targets
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
if
(
isFunction
(
args
.
done
))
{
if
(
args
.
done
)
{
args
.
done
();
}
args
.
done
();
}
};
};
c3_chart_internal_fn
.
loadFromArgs
=
function
(
args
)
{
c3_chart_internal_fn
.
loadFromArgs
=
function
(
args
)
{
var
$$
=
this
;
var
$$
=
this
;
...
@@ -2608,7 +2592,7 @@
...
@@ -2608,7 +2592,7 @@
};
};
c3_chart_internal_fn
.
unload
=
function
(
targetIds
,
done
)
{
c3_chart_internal_fn
.
unload
=
function
(
targetIds
,
done
)
{
var
$$
=
this
;
var
$$
=
this
;
if
(
!
isFunction
(
done
)
)
{
if
(
!
done
)
{
done
=
function
()
{};
done
=
function
()
{};
}
}
// filter existing target
// filter existing target
...
@@ -3742,14 +3726,14 @@
...
@@ -3742,14 +3726,14 @@
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'cursor'
,
'pointer'
)
.
style
(
'cursor'
,
'pointer'
)
.
on
(
'click'
,
function
(
id
)
{
.
on
(
'click'
,
function
(
id
)
{
isFunction
(
config
[
__legend_item_onclick
])
?
config
[
__legend_item_onclick
].
call
(
$$
,
id
)
:
$$
.
api
.
toggle
(
id
);
config
[
__legend_item_onclick
]
?
config
[
__legend_item_onclick
].
call
(
$$
,
id
)
:
$$
.
api
.
toggle
(
id
);
})
})
.
on
(
'mouseover'
,
function
(
id
)
{
.
on
(
'mouseover'
,
function
(
id
)
{
$$
.
d3
.
select
(
this
).
classed
(
CLASS
[
_legendItemFocused
],
true
);
$$
.
d3
.
select
(
this
).
classed
(
CLASS
[
_legendItemFocused
],
true
);
if
(
!
$$
.
transiting
)
{
if
(
!
$$
.
transiting
)
{
$$
.
api
.
focus
(
id
);
$$
.
api
.
focus
(
id
);
}
}
if
(
isFunction
(
config
[
__legend_item_onmouseover
])
)
{
if
(
config
[
__legend_item_onmouseover
]
)
{
config
[
__legend_item_onmouseover
].
call
(
$$
,
id
);
config
[
__legend_item_onmouseover
].
call
(
$$
,
id
);
}
}
})
})
...
@@ -3758,7 +3742,7 @@
...
@@ -3758,7 +3742,7 @@
if
(
!
$$
.
transiting
)
{
if
(
!
$$
.
transiting
)
{
$$
.
api
.
revert
();
$$
.
api
.
revert
();
}
}
if
(
isFunction
(
config
[
__legend_item_onmouseout
])
)
{
if
(
config
[
__legend_item_onmouseout
]
)
{
config
[
__legend_item_onmouseout
].
call
(
$$
,
id
);
config
[
__legend_item_onmouseout
].
call
(
$$
,
id
);
}
}
});
});
...
@@ -3903,7 +3887,7 @@
...
@@ -3903,7 +3887,7 @@
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
if
(
config
[
__axis_x_tick_format
])
{
if
(
config
[
__axis_x_tick_format
])
{
if
(
isFunction
(
config
[
__axis_x_tick_format
])
)
{
if
(
config
[
__axis_x_tick_format
]
)
{
format
=
config
[
__axis_x_tick_format
];
format
=
config
[
__axis_x_tick_format
];
}
else
if
(
$$
.
isTimeSeries
())
{
}
else
if
(
$$
.
isTimeSeries
())
{
format
=
function
(
date
)
{
format
=
function
(
date
)
{
...
@@ -5102,10 +5086,10 @@
...
@@ -5102,10 +5086,10 @@
var
$$
=
this
,
data_labels
=
$$
.
config
[
__data_labels
],
var
$$
=
this
,
data_labels
=
$$
.
config
[
__data_labels
],
format
=
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
format
=
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
// find format according to axis id
// find format according to axis id
if
(
isFunction
(
data_labels
.
format
)
)
{
if
(
data_labels
.
format
)
{
format
=
data_labels
.
format
;
format
=
data_labels
.
format
;
}
else
if
(
typeof
data_labels
.
format
===
'object'
)
{
}
else
if
(
typeof
data_labels
.
format
===
'object'
)
{
if
(
isFunction
(
data_labels
.
format
[
axisId
])
)
{
if
(
data_labels
.
format
[
axisId
]
)
{
format
=
data_labels
.
format
[
axisId
];
format
=
data_labels
.
format
[
axisId
];
}
}
}
}
...
@@ -5555,7 +5539,7 @@
...
@@ -5555,7 +5539,7 @@
args
=
args
||
{};
args
=
args
||
{};
$$
.
unload
(
$$
.
mapToTargetIds
(
args
.
ids
),
function
()
{
$$
.
unload
(
$$
.
mapToTargetIds
(
args
.
ids
),
function
()
{
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
if
(
isFunction
(
args
.
done
)
)
{
args
.
done
();
}
if
(
args
.
done
)
{
args
.
done
();
}
});
});
};
};
...
...
c3.min.js
View file @
2fa6a3b5
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/api.js
View file @
2fa6a3b5
...
@@ -140,7 +140,7 @@ c3_chart_fn.unload = function (args) {
...
@@ -140,7 +140,7 @@ c3_chart_fn.unload = function (args) {
args
=
args
||
{};
args
=
args
||
{};
$$
.
unload
(
$$
.
mapToTargetIds
(
args
.
ids
),
function
()
{
$$
.
unload
(
$$
.
mapToTargetIds
(
args
.
ids
),
function
()
{
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
if
(
isFunction
(
args
.
done
)
)
{
args
.
done
();
}
if
(
args
.
done
)
{
args
.
done
();
}
});
});
};
};
...
...
src/axis.js
View file @
2fa6a3b5
...
@@ -63,7 +63,7 @@ c3_chart_internal_fn.getXAxisTickFormat = function () {
...
@@ -63,7 +63,7 @@ c3_chart_internal_fn.getXAxisTickFormat = function () {
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
,
config
=
$$
.
config
,
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
format
=
$$
.
isTimeSeries
()
?
$$
.
defaultAxisTimeFormat
:
$$
.
isCategorized
()
?
$$
.
categoryName
:
function
(
v
)
{
return
v
<
0
?
v
.
toFixed
(
0
)
:
v
;
};
if
(
config
[
__axis_x_tick_format
])
{
if
(
config
[
__axis_x_tick_format
])
{
if
(
isFunction
(
config
[
__axis_x_tick_format
])
)
{
if
(
config
[
__axis_x_tick_format
]
)
{
format
=
config
[
__axis_x_tick_format
];
format
=
config
[
__axis_x_tick_format
];
}
else
if
(
$$
.
isTimeSeries
())
{
}
else
if
(
$$
.
isTimeSeries
())
{
format
=
function
(
date
)
{
format
=
function
(
date
)
{
...
...
src/core.js
View file @
2fa6a3b5
...
@@ -129,9 +129,9 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -129,9 +129,9 @@ c3_chart_internal_fn.initWithData = function (data) {
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
main
,
eventRect
,
binding
=
true
;
var
main
,
eventRect
,
binding
=
true
;
if
(
isFunction
(
$$
.
initPie
)
)
{
$$
.
initPie
();
}
if
(
$$
.
initPie
)
{
$$
.
initPie
();
}
if
(
isFunction
(
$$
.
initBrush
)
)
{
$$
.
initBrush
();
}
if
(
$$
.
initBrush
)
{
$$
.
initBrush
();
}
if
(
isFunction
(
$$
.
initZoom
)
)
{
$$
.
initZoom
();
}
if
(
$$
.
initZoom
)
{
$$
.
initZoom
();
}
$$
.
selectChart
=
d3
.
select
(
config
[
__bindto
]);
$$
.
selectChart
=
d3
.
select
(
config
[
__bindto
]);
if
(
$$
.
selectChart
.
empty
())
{
if
(
$$
.
selectChart
.
empty
())
{
...
@@ -196,9 +196,9 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -196,9 +196,9 @@ c3_chart_internal_fn.initWithData = function (data) {
// Define regions
// Define regions
main
=
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'main'
));
main
=
$$
.
main
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'main'
));
if
(
isFunction
(
$$
.
initSubchart
)
)
{
$$
.
initSubchart
();
}
if
(
$$
.
initSubchart
)
{
$$
.
initSubchart
();
}
if
(
isFunction
(
$$
.
initTooltip
)
)
{
$$
.
initTooltip
();
}
if
(
$$
.
initTooltip
)
{
$$
.
initTooltip
();
}
if
(
isFunction
(
$$
.
initLegend
)
)
{
$$
.
initLegend
();
}
if
(
$$
.
initLegend
)
{
$$
.
initLegend
();
}
/*-- Main Region --*/
/*-- Main Region --*/
...
@@ -235,12 +235,8 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -235,12 +235,8 @@ c3_chart_internal_fn.initWithData = function (data) {
.
attr
(
"class"
,
CLASS
[
_chartLines
]);
.
attr
(
"class"
,
CLASS
[
_chartLines
]);
// Define g for arc chart area
// Define g for arc chart area
if
(
isFunction
(
$$
.
initArc
))
{
if
(
$$
.
initArc
)
{
$$
.
initArc
();
}
$$
.
initArc
();
if
(
$$
.
initGauge
)
{
$$
.
initGauge
();
}
}
if
(
isFunction
(
$$
.
initGauge
))
{
$$
.
initGauge
();
}
main
.
select
(
'.'
+
CLASS
[
_chart
]).
append
(
"g"
)
main
.
select
(
'.'
+
CLASS
[
_chart
]).
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_chartTexts
]);
.
attr
(
"class"
,
CLASS
[
_chartTexts
]);
...
@@ -256,7 +252,7 @@ c3_chart_internal_fn.initWithData = function (data) {
...
@@ -256,7 +252,7 @@ c3_chart_internal_fn.initWithData = function (data) {
// Set default extent if defined
// Set default extent if defined
if
(
config
[
__axis_x_default
])
{
if
(
config
[
__axis_x_default
])
{
$$
.
brush
.
extent
(
!
isFunction
(
config
[
__axis_x_default
])
?
config
[
__axis_x_default
]
:
config
[
__axis_x_default
](
$$
.
getXDomain
())
);
$$
.
brush
.
extent
(
isFunction
(
config
[
__axis_x_default
])
?
config
[
__axis_x_default
](
$$
.
getXDomain
())
:
config
[
__axis_x_default
]
);
}
}
// Add Axis
// Add Axis
...
@@ -358,7 +354,7 @@ c3_chart_internal_fn.updateSizes = function () {
...
@@ -358,7 +354,7 @@ c3_chart_internal_fn.updateSizes = function () {
}
}
// for legend
// for legend
if
(
isFunction
(
$$
.
updateSizeForLegend
)
)
{
$$
.
updateSizeForLegend
(
legendHeight
,
legendWidth
);
}
if
(
$$
.
updateSizeForLegend
)
{
$$
.
updateSizeForLegend
(
legendHeight
,
legendWidth
);
}
$$
.
width
=
$$
.
currentWidth
-
$$
.
margin
.
left
-
$$
.
margin
.
right
;
$$
.
width
=
$$
.
currentWidth
-
$$
.
margin
.
left
-
$$
.
margin
.
right
;
$$
.
height
=
$$
.
currentHeight
-
$$
.
margin
.
top
-
$$
.
margin
.
bottom
;
$$
.
height
=
$$
.
currentHeight
-
$$
.
margin
.
top
-
$$
.
margin
.
bottom
;
...
@@ -373,9 +369,7 @@ c3_chart_internal_fn.updateSizes = function () {
...
@@ -373,9 +369,7 @@ c3_chart_internal_fn.updateSizes = function () {
// for arc
// for arc
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcWidth
=
$$
.
width
-
(
$$
.
isLegendRight
?
legendWidth
+
10
:
0
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
$$
.
arcHeight
=
$$
.
height
-
(
$$
.
isLegendRight
?
0
:
10
);
if
(
isFunction
(
$$
.
updateRadius
))
{
if
(
$$
.
updateRadius
)
{
$$
.
updateRadius
();
}
$$
.
updateRadius
();
}
if
(
$$
.
isLegendRight
&&
hasArc
)
{
if
(
$$
.
isLegendRight
&&
hasArc
)
{
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
$$
.
margin3
.
left
=
$$
.
arcWidth
/
2
+
$$
.
radiusExpanded
*
1.1
;
...
@@ -441,12 +435,8 @@ c3_chart_internal_fn.updateTargets = function (targets) {
...
@@ -441,12 +435,8 @@ c3_chart_internal_fn.updateTargets = function (targets) {
// MEMO: can not keep same color...
// MEMO: can not keep same color...
//mainLineUpdate.exit().remove();
//mainLineUpdate.exit().remove();
if
(
isFunction
(
$$
.
updateTargetsForArc
))
{
if
(
$$
.
updateTargetsForArc
)
{
$$
.
updateTargetsForArc
(
targets
);
}
$$
.
updateTargetsForArc
(
targets
);
if
(
$$
.
updateTargetsForSubchart
)
{
$$
.
updateTargetsForSubchart
(
targets
);
}
}
if
(
isFunction
(
$$
.
updateTargetsForSubchart
))
{
$$
.
updateTargetsForSubchart
(
targets
);
}
/*-- Show --*/
/*-- Show --*/
...
@@ -653,12 +643,10 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -653,12 +643,10 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
}
}
// arc
// arc
if
(
isFunction
(
$$
.
redrawArc
))
{
if
(
$$
.
redrawArc
)
{
$$
.
redrawArc
(
duration
,
durationForExit
,
withTransform
);
}
$$
.
redrawArc
(
duration
,
durationForExit
,
withTransform
);
}
// subchart
// subchart
if
(
isFunction
(
$$
.
redrawSubchart
)
)
{
if
(
$$
.
redrawSubchart
)
{
$$
.
redrawSubchart
(
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
);
$$
.
redrawSubchart
(
withSubchart
,
transitions
,
duration
,
durationForExit
,
areaIndices
,
barIndices
,
lineIndices
);
}
}
...
@@ -906,7 +894,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -906,7 +894,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$
.
withoutFadeIn
[
id
]
=
true
;
$$
.
withoutFadeIn
[
id
]
=
true
;
});
});
if
(
isFunction
(
$$
.
updateZoom
)
)
{
$$
.
updateZoom
();
}
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
};
};
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
...
...
src/data.load.js
View file @
2fa6a3b5
...
@@ -30,9 +30,7 @@ c3_chart_internal_fn.load = function (targets, args) {
...
@@ -30,9 +30,7 @@ c3_chart_internal_fn.load = function (targets, args) {
// Redraw with new targets
// Redraw with new targets
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
if
(
isFunction
(
args
.
done
))
{
if
(
args
.
done
)
{
args
.
done
();
}
args
.
done
();
}
};
};
c3_chart_internal_fn
.
loadFromArgs
=
function
(
args
)
{
c3_chart_internal_fn
.
loadFromArgs
=
function
(
args
)
{
var
$$
=
this
;
var
$$
=
this
;
...
@@ -59,7 +57,7 @@ c3_chart_internal_fn.loadFromArgs = function (args) {
...
@@ -59,7 +57,7 @@ c3_chart_internal_fn.loadFromArgs = function (args) {
};
};
c3_chart_internal_fn
.
unload
=
function
(
targetIds
,
done
)
{
c3_chart_internal_fn
.
unload
=
function
(
targetIds
,
done
)
{
var
$$
=
this
;
var
$$
=
this
;
if
(
!
isFunction
(
done
)
)
{
if
(
!
done
)
{
done
=
function
()
{};
done
=
function
()
{};
}
}
// filter existing target
// filter existing target
...
...
src/format.js
View file @
2fa6a3b5
...
@@ -27,10 +27,10 @@ c3_chart_internal_fn.formatByAxisId = function (axisId) {
...
@@ -27,10 +27,10 @@ c3_chart_internal_fn.formatByAxisId = function (axisId) {
var
$$
=
this
,
data_labels
=
$$
.
config
[
__data_labels
],
var
$$
=
this
,
data_labels
=
$$
.
config
[
__data_labels
],
format
=
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
format
=
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
// find format according to axis id
// find format according to axis id
if
(
isFunction
(
data_labels
.
format
)
)
{
if
(
data_labels
.
format
)
{
format
=
data_labels
.
format
;
format
=
data_labels
.
format
;
}
else
if
(
typeof
data_labels
.
format
===
'object'
)
{
}
else
if
(
typeof
data_labels
.
format
===
'object'
)
{
if
(
isFunction
(
data_labels
.
format
[
axisId
])
)
{
if
(
data_labels
.
format
[
axisId
]
)
{
format
=
data_labels
.
format
[
axisId
];
format
=
data_labels
.
format
[
axisId
];
}
}
}
}
...
...
src/legend.js
View file @
2fa6a3b5
...
@@ -197,14 +197,14 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -197,14 +197,14 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'visibility'
,
function
(
id
)
{
return
$$
.
isLegendToShow
(
id
)
?
'visible'
:
'hidden'
;
})
.
style
(
'cursor'
,
'pointer'
)
.
style
(
'cursor'
,
'pointer'
)
.
on
(
'click'
,
function
(
id
)
{
.
on
(
'click'
,
function
(
id
)
{
isFunction
(
config
[
__legend_item_onclick
])
?
config
[
__legend_item_onclick
].
call
(
$$
,
id
)
:
$$
.
api
.
toggle
(
id
);
config
[
__legend_item_onclick
]
?
config
[
__legend_item_onclick
].
call
(
$$
,
id
)
:
$$
.
api
.
toggle
(
id
);
})
})
.
on
(
'mouseover'
,
function
(
id
)
{
.
on
(
'mouseover'
,
function
(
id
)
{
$$
.
d3
.
select
(
this
).
classed
(
CLASS
[
_legendItemFocused
],
true
);
$$
.
d3
.
select
(
this
).
classed
(
CLASS
[
_legendItemFocused
],
true
);
if
(
!
$$
.
transiting
)
{
if
(
!
$$
.
transiting
)
{
$$
.
api
.
focus
(
id
);
$$
.
api
.
focus
(
id
);
}
}
if
(
isFunction
(
config
[
__legend_item_onmouseover
])
)
{
if
(
config
[
__legend_item_onmouseover
]
)
{
config
[
__legend_item_onmouseover
].
call
(
$$
,
id
);
config
[
__legend_item_onmouseover
].
call
(
$$
,
id
);
}
}
})
})
...
@@ -213,7 +213,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -213,7 +213,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
if
(
!
$$
.
transiting
)
{
if
(
!
$$
.
transiting
)
{
$$
.
api
.
revert
();
$$
.
api
.
revert
();
}
}
if
(
isFunction
(
config
[
__legend_item_onmouseout
])
)
{
if
(
config
[
__legend_item_onmouseout
]
)
{
config
[
__legend_item_onmouseout
].
call
(
$$
,
id
);
config
[
__legend_item_onmouseout
].
call
(
$$
,
id
);
}
}
});
});
...
...
src/scale.js
View file @
2fa6a3b5
...
@@ -81,7 +81,5 @@ c3_chart_internal_fn.updateScales = function () {
...
@@ -81,7 +81,5 @@ c3_chart_internal_fn.updateScales = function () {
if
(
config
[
__zoom_enabled
])
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
if
(
config
[
__zoom_enabled
])
{
$$
.
zoom
.
scale
(
$$
.
x
);
}
}
}
// update for arc
// update for arc
if
(
isFunction
(
$$
.
updateArc
))
{
if
(
$$
.
updateArc
)
{
$$
.
updateArc
();
}
$$
.
updateArc
();
}
};
};
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