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
0e37a5b2
Commit
0e37a5b2
authored
Nov 13, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'w-green-master'
parents
6d43320f
0b6b69f1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
4 deletions
+78
-4
c3.js
c3.js
+16
-2
axis-spec.js
spec/axis-spec.js
+46
-0
axis.js
src/axis.js
+7
-1
config.js
src/config.js
+5
-0
core.js
src/core.js
+3
-0
scale.js
src/scale.js
+1
-1
No files found.
c3.js
View file @
0e37a5b2
...
...
@@ -657,6 +657,9 @@
c3_chart_internal_fn
.
isTimeSeries
=
function
()
{
return
this
.
config
.
axis_x_type
===
'timeseries'
;
};
c3_chart_internal_fn
.
isYaxisTimeSeries
=
function
()
{
return
this
.
config
.
axis_y_type
===
'timeseries'
;
};
c3_chart_internal_fn
.
isCategorized
=
function
()
{
return
this
.
config
.
axis_x_type
.
indexOf
(
'categor'
)
>=
0
;
};
...
...
@@ -996,6 +999,7 @@
axis_x_extent
:
undefined
,
axis_x_label
:
{},
axis_y_show
:
true
,
axis_y_type
:
undefined
,
axis_y_max
:
undefined
,
axis_y_min
:
undefined
,
axis_y_center
:
undefined
,
...
...
@@ -1004,6 +1008,10 @@
axis_y_tick_outer
:
true
,
axis_y_tick_values
:
null
,
axis_y_tick_count
:
undefined
,
axis_y_ticks
:
{},
axis_y_ticks_time
:
{},
axis_y_ticks_time_value
:
undefined
,
axis_y_ticks_time_interval
:
undefined
,
axis_y_padding
:
{},
axis_y_default
:
undefined
,
axis_y2_show
:
false
,
...
...
@@ -1156,7 +1164,7 @@
return
scale
;
};
c3_chart_internal_fn
.
getY
=
function
(
min
,
max
,
domain
)
{
var
scale
=
this
.
getScale
(
min
,
max
);
var
scale
=
this
.
getScale
(
min
,
max
,
this
.
isYaxisTimeSeries
()
);
if
(
domain
)
{
scale
.
domain
(
domain
);
}
return
scale
;
};
...
...
@@ -3982,7 +3990,13 @@
};
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
};
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
if
(
this
.
isYaxisTimeSeries
())
{
var
timeValue
=
this
.
config
.
axis_y_ticks_time_value
;
var
timeInterval
=
this
.
config
.
axis_y_ticks_time_interval
;
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
this
.
d3
.
time
[
timeValue
],
timeInterval
);
}
else
{
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
}
};
c3_chart_internal_fn
.
getAxisId
=
function
(
id
)
{
var
config
=
this
.
config
;
...
...
spec/axis-spec.js
View file @
0e37a5b2
...
...
@@ -86,6 +86,52 @@ describe('c3 chart axis', function () {
});
describe
(
'axis y timeseries'
,
function
()
{
var
args
=
{
data
:
{
columns
:
[
[
"times"
,
60000
,
120000
,
180000
,
240000
]
]
},
axis
:
{
y
:
{
type
:
'timeseries'
,
tick
:
{
values
:
null
,
count
:
undefined
,
},
ticks
:
{
time
:
{
value
:
'seconds'
,
interval
:
30
}
},
},
}
};
beforeEach
(
function
()
{
chart
=
window
.
c3
.
generate
(
args
);
});
it
(
'should have 7 ticks on y axis'
,
function
()
{
var
ticksSize
=
d3
.
select
(
'.c3-axis-y'
).
selectAll
(
'g.tick'
).
size
();
expect
(
ticksSize
).
toBe
(
7
);
// the count starts at initial value and increments by the set interval
});
it
(
'should have specified 30 second intervals'
,
function
()
{
var
prevValue
;
d3
.
select
(
'.c3-axis-y'
).
selectAll
(
'g.tick'
).
each
(
function
(
d
,
i
)
{
if
(
i
!==
0
)
{
var
result
=
d
-
prevValue
;
expect
(
result
).
toEqual
(
30000
);
// expressed in milliseconds
}
prevValue
=
d
;
});
});
});
describe
(
'axis.x.tick.width'
,
function
()
{
describe
(
'indexed x axis and y/y2 axis'
,
function
()
{
...
...
src/axis.js
View file @
0e37a5b2
...
...
@@ -65,7 +65,13 @@ c3_chart_internal_fn.getXAxis = function (scale, orient, tickFormat, tickValues,
};
c3_chart_internal_fn
.
getYAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
,
withOuterTick
)
{
var
axisParams
=
{
withOuterTick
:
withOuterTick
};
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
if
(
this
.
isYaxisTimeSeries
())
{
var
timeValue
=
this
.
config
.
axis_y_ticks_time_value
;
var
timeInterval
=
this
.
config
.
axis_y_ticks_time_interval
;
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
ticks
(
this
.
d3
.
time
[
timeValue
],
timeInterval
);
}
else
{
return
c3_axis
(
this
.
d3
,
axisParams
).
scale
(
scale
).
orient
(
orient
).
tickFormat
(
tickFormat
).
tickValues
(
tickValues
);
}
};
c3_chart_internal_fn
.
getAxisId
=
function
(
id
)
{
var
config
=
this
.
config
;
...
...
src/config.js
View file @
0e37a5b2
...
...
@@ -101,6 +101,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
axis_x_extent
:
undefined
,
axis_x_label
:
{},
axis_y_show
:
true
,
axis_y_type
:
undefined
,
axis_y_max
:
undefined
,
axis_y_min
:
undefined
,
axis_y_center
:
undefined
,
...
...
@@ -109,6 +110,10 @@ c3_chart_internal_fn.getDefaultConfig = function () {
axis_y_tick_outer
:
true
,
axis_y_tick_values
:
null
,
axis_y_tick_count
:
undefined
,
axis_y_ticks
:
{},
axis_y_ticks_time
:
{},
axis_y_ticks_time_value
:
undefined
,
axis_y_ticks_time_interval
:
undefined
,
axis_y_padding
:
{},
axis_y_default
:
undefined
,
axis_y2_show
:
false
,
...
...
src/core.js
View file @
0e37a5b2
...
...
@@ -652,6 +652,9 @@ c3_chart_internal_fn.updateAndRedraw = function (options) {
c3_chart_internal_fn
.
isTimeSeries
=
function
()
{
return
this
.
config
.
axis_x_type
===
'timeseries'
;
};
c3_chart_internal_fn
.
isYaxisTimeSeries
=
function
()
{
return
this
.
config
.
axis_y_type
===
'timeseries'
;
};
c3_chart_internal_fn
.
isCategorized
=
function
()
{
return
this
.
config
.
axis_x_type
.
indexOf
(
'categor'
)
>=
0
;
};
...
...
src/scale.js
View file @
0e37a5b2
...
...
@@ -39,7 +39,7 @@ c3_chart_internal_fn.getX = function (min, max, domain, offset) {
return
scale
;
};
c3_chart_internal_fn
.
getY
=
function
(
min
,
max
,
domain
)
{
var
scale
=
this
.
getScale
(
min
,
max
);
var
scale
=
this
.
getScale
(
min
,
max
,
this
.
isYaxisTimeSeries
()
);
if
(
domain
)
{
scale
.
domain
(
domain
);
}
return
scale
;
};
...
...
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