Commit 26af06f4 authored by Masayuki Tanaka's avatar Masayuki Tanaka

Add x format for none timeseries data

parent 5c294fcc
...@@ -329,15 +329,22 @@ ...@@ -329,15 +329,22 @@
function getXAxis(scale, orient) { function getXAxis(scale, orient) {
var axis = (isCategorized ? categoryAxis() : d3.svg.axis()).scale(scale).orient(orient); var axis = (isCategorized ? categoryAxis() : d3.svg.axis()).scale(scale).orient(orient);
if (isTimeSeries) { var tickFormat = isTimeSeries ? defaultTimeFormat : null;
axis.tickFormat(__axis_x_tick_format ? function (date) { return d3.time.format(__axis_x_tick_format)(date); } : defaultTimeFormat);
// Set tick format
if (__axis_x_tick_format) {
tickFormat = typeof __axis_x_tick_format === 'function' ? __axis_x_tick_format : isTimeSeries ? function (date) { return d3.time.format(__axis_x_tick_format)(date); } : null;
} }
axis.tickFormat(tickFormat);
// Set categories
if (isCategorized) { if (isCategorized) {
axis.categories(__axis_x_categories).tickCentered(__axis_x_tick_centered); axis.categories(__axis_x_categories).tickCentered(__axis_x_tick_centered);
} else { } else {
// TODO: fix // TODO: fix
axis.tickOffset = function () { return 0; }; axis.tickOffset = function () { return 0; };
} }
return axis; return axis;
} }
function getYAxis(scale, orient) { function getYAxis(scale, orient) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment