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
ed6f738c
You need to sign in or sign up before continuing.
Commit
ed6f738c
authored
Sep 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix update x domain for flow
parent
26d92117
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
c3.js
c3.js
+8
-8
c3.min.js
c3.min.js
+0
-0
api.flow.js
src/api.flow.js
+3
-2
core.js
src/core.js
+3
-2
domain.js
src/domain.js
+2
-4
No files found.
c3.js
View file @
ed6f738c
...
@@ -412,7 +412,7 @@
...
@@ -412,7 +412,7 @@
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withLegend
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
with
TrimXDomain
,
with
Legend
;
var
hideAxis
=
$$
.
hasArcType
();
var
hideAxis
=
$$
.
hasArcType
();
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
var
duration
,
durationForExit
,
durationForAxis
;
...
@@ -429,6 +429,7 @@
...
@@ -429,6 +429,7 @@
withTransform
=
getOption
(
options
,
"withTransform"
,
false
);
withTransform
=
getOption
(
options
,
"withTransform"
,
false
);
withUpdateXDomain
=
getOption
(
options
,
"withUpdateXDomain"
,
false
);
withUpdateXDomain
=
getOption
(
options
,
"withUpdateXDomain"
,
false
);
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withTrimXDomain
=
getOption
(
options
,
"withTrimXDomain"
,
true
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
...
@@ -450,7 +451,7 @@
...
@@ -450,7 +451,7 @@
}
}
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
// update axis tick values according to options
// update axis tick values according to options
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
);
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
);
...
@@ -1351,7 +1352,7 @@
...
@@ -1351,7 +1352,7 @@
}
}
return
[
min
,
max
];
return
[
min
,
max
];
};
};
c3_chart_internal_fn
.
updateXDomain
=
function
(
targets
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
domain
)
{
c3_chart_internal_fn
.
updateXDomain
=
function
(
targets
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrim
,
domain
)
{
var
$$
=
this
,
config
=
$$
.
config
;
var
$$
=
this
,
config
=
$$
.
config
;
if
(
withUpdateOrgXDomain
)
{
if
(
withUpdateOrgXDomain
)
{
...
@@ -1367,9 +1368,7 @@
...
@@ -1367,9 +1368,7 @@
}
}
// Trim domain when too big by zoom mousemove event
// Trim domain when too big by zoom mousemove event
if
(
!
domain
)
{
if
(
withTrim
)
{
$$
.
x
.
domain
(
$$
.
trimXDomain
(
$$
.
x
.
orgDomain
()));
}
$$
.
x
.
domain
(
$$
.
trimXDomain
(
$$
.
x
.
orgDomain
()));
}
return
$$
.
x
.
domain
();
return
$$
.
x
.
domain
();
};
};
...
@@ -5601,12 +5600,12 @@
...
@@ -5601,12 +5600,12 @@
diff
=
1
;
diff
=
1
;
}
}
domain
=
[
baseValue
.
x
-
diff
,
baseValue
.
x
];
domain
=
[
baseValue
.
x
-
diff
,
baseValue
.
x
];
$$
.
updateXDomain
(
null
,
true
,
true
,
domain
);
$$
.
updateXDomain
(
null
,
true
,
true
,
false
,
domain
);
}
else
if
(
orgDataCount
===
1
)
{
}
else
if
(
orgDataCount
===
1
)
{
if
(
$$
.
isTimeSeries
())
{
if
(
$$
.
isTimeSeries
())
{
diff
=
(
baseTarget
.
values
[
baseTarget
.
values
.
length
-
1
].
x
-
baseValue
.
x
)
/
2
;
diff
=
(
baseTarget
.
values
[
baseTarget
.
values
.
length
-
1
].
x
-
baseValue
.
x
)
/
2
;
domain
=
[
new
Date
(
+
baseValue
.
x
-
diff
),
new
Date
(
+
baseValue
.
x
+
diff
)];
domain
=
[
new
Date
(
+
baseValue
.
x
-
diff
),
new
Date
(
+
baseValue
.
x
+
diff
)];
$$
.
updateXDomain
(
null
,
true
,
true
,
domain
);
$$
.
updateXDomain
(
null
,
true
,
true
,
false
,
domain
);
}
}
}
}
...
@@ -5624,6 +5623,7 @@
...
@@ -5624,6 +5623,7 @@
},
},
withLegend
:
true
,
withLegend
:
true
,
withTransition
:
orgDataCount
>
1
,
withTransition
:
orgDataCount
>
1
,
withTrimXDomain
:
false
});
});
};
};
...
...
c3.min.js
View file @
ed6f738c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/api.flow.js
View file @
ed6f738c
...
@@ -113,12 +113,12 @@ c3_chart_fn.flow = function (args) {
...
@@ -113,12 +113,12 @@ c3_chart_fn.flow = function (args) {
diff
=
1
;
diff
=
1
;
}
}
domain
=
[
baseValue
.
x
-
diff
,
baseValue
.
x
];
domain
=
[
baseValue
.
x
-
diff
,
baseValue
.
x
];
$$
.
updateXDomain
(
null
,
true
,
true
,
domain
);
$$
.
updateXDomain
(
null
,
true
,
true
,
false
,
domain
);
}
else
if
(
orgDataCount
===
1
)
{
}
else
if
(
orgDataCount
===
1
)
{
if
(
$$
.
isTimeSeries
())
{
if
(
$$
.
isTimeSeries
())
{
diff
=
(
baseTarget
.
values
[
baseTarget
.
values
.
length
-
1
].
x
-
baseValue
.
x
)
/
2
;
diff
=
(
baseTarget
.
values
[
baseTarget
.
values
.
length
-
1
].
x
-
baseValue
.
x
)
/
2
;
domain
=
[
new
Date
(
+
baseValue
.
x
-
diff
),
new
Date
(
+
baseValue
.
x
+
diff
)];
domain
=
[
new
Date
(
+
baseValue
.
x
-
diff
),
new
Date
(
+
baseValue
.
x
+
diff
)];
$$
.
updateXDomain
(
null
,
true
,
true
,
domain
);
$$
.
updateXDomain
(
null
,
true
,
true
,
false
,
domain
);
}
}
}
}
...
@@ -136,6 +136,7 @@ c3_chart_fn.flow = function (args) {
...
@@ -136,6 +136,7 @@ c3_chart_fn.flow = function (args) {
},
},
withLegend
:
true
,
withLegend
:
true
,
withTransition
:
orgDataCount
>
1
,
withTransition
:
orgDataCount
>
1
,
withTrimXDomain
:
false
});
});
};
};
...
...
src/core.js
View file @
ed6f738c
...
@@ -407,7 +407,7 @@ c3_chart_internal_fn.updateTargets = function (targets) {
...
@@ -407,7 +407,7 @@ c3_chart_internal_fn.updateTargets = function (targets) {
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withLegend
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
with
TrimXDomain
,
with
Legend
;
var
hideAxis
=
$$
.
hasArcType
();
var
hideAxis
=
$$
.
hasArcType
();
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
var
duration
,
durationForExit
,
durationForAxis
;
...
@@ -424,6 +424,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -424,6 +424,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
withTransform
=
getOption
(
options
,
"withTransform"
,
false
);
withTransform
=
getOption
(
options
,
"withTransform"
,
false
);
withUpdateXDomain
=
getOption
(
options
,
"withUpdateXDomain"
,
false
);
withUpdateXDomain
=
getOption
(
options
,
"withUpdateXDomain"
,
false
);
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withTrimXDomain
=
getOption
(
options
,
"withTrimXDomain"
,
true
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
...
@@ -445,7 +446,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
...
@@ -445,7 +446,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
}
}
if
(
targetsToShow
.
length
)
{
if
(
targetsToShow
.
length
)
{
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
);
$$
.
updateXDomain
(
targetsToShow
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
);
// update axis tick values according to options
// update axis tick values according to options
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
if
(
!
config
.
axis_x_tick_values
&&
(
config
.
axis_x_tick_fit
||
config
.
axis_x_tick_count
))
{
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
);
tickValues
=
$$
.
generateTickValues
(
$$
.
mapTargetsToUniqueXs
(
targetsToShow
),
config
.
axis_x_tick_count
);
...
...
src/domain.js
View file @
ed6f738c
...
@@ -187,7 +187,7 @@ c3_chart_internal_fn.getXDomain = function (targets) {
...
@@ -187,7 +187,7 @@ c3_chart_internal_fn.getXDomain = function (targets) {
}
}
return
[
min
,
max
];
return
[
min
,
max
];
};
};
c3_chart_internal_fn
.
updateXDomain
=
function
(
targets
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
domain
)
{
c3_chart_internal_fn
.
updateXDomain
=
function
(
targets
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrim
,
domain
)
{
var
$$
=
this
,
config
=
$$
.
config
;
var
$$
=
this
,
config
=
$$
.
config
;
if
(
withUpdateOrgXDomain
)
{
if
(
withUpdateOrgXDomain
)
{
...
@@ -203,9 +203,7 @@ c3_chart_internal_fn.updateXDomain = function (targets, withUpdateXDomain, withU
...
@@ -203,9 +203,7 @@ c3_chart_internal_fn.updateXDomain = function (targets, withUpdateXDomain, withU
}
}
// Trim domain when too big by zoom mousemove event
// Trim domain when too big by zoom mousemove event
if
(
!
domain
)
{
if
(
withTrim
)
{
$$
.
x
.
domain
(
$$
.
trimXDomain
(
$$
.
x
.
orgDomain
()));
}
$$
.
x
.
domain
(
$$
.
trimXDomain
(
$$
.
x
.
orgDomain
()));
}
return
$$
.
x
.
domain
();
return
$$
.
x
.
domain
();
};
};
...
...
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