Skip to content

Commit 67443d8

Browse files
committed
Merge pull request #31 from anwfr/feature-xAxis-time
Added feature: xAxis.time
2 parents ba8f9a9 + 4ba811c commit 67443d8

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

rickshaw.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,29 @@ angular.module('angular-rickshaw', [])
136136

137137
if (scope.features) {
138138
if (scope.features.xAxis) {
139-
var xAxisConfig = {
140-
graph: graph
141-
};
142-
if (scope.features.xAxis.timeUnit) {
143-
var time = new Rickshaw.Fixtures.Time();
144-
xAxisConfig.timeUnit = time.unit(scope.features.xAxis.timeUnit);
145-
}
146-
if (scope.features.xAxis.tickFormat) {
147-
xAxisConfig.tickFormat = scope.features.xAxis.tickFormat;
148-
}
149-
if (scope.features.xAxis.ticksTreatment) {
150-
xAxisConfig.ticksTreatment = scope.features.xAxis.ticksTreatment;
151-
}
152139
if (!xAxis) {
153-
xAxis = new Rickshaw.Graph.Axis.X(xAxisConfig);
140+
var xAxisConfig = {
141+
graph: graph
142+
};
143+
if (scope.features.xAxis.timeUnit) {
144+
var time = new Rickshaw.Fixtures.Time();
145+
xAxisConfig.timeUnit = time.unit(scope.features.xAxis.timeUnit);
146+
}
147+
if (scope.features.xAxis.tickFormat) {
148+
xAxisConfig.tickFormat = scope.features.xAxis.tickFormat;
149+
}
150+
if (scope.features.xAxis.ticksTreatment) {
151+
xAxisConfig.ticksTreatment = scope.features.xAxis.ticksTreatment;
152+
}
153+
if (scope.features.xAxis.time) {
154+
if (scope.features.xAxis.time.local) {
155+
xAxisConfig.timeFixture = new Rickshaw.Fixtures.Time.Local();
156+
}
157+
xAxis = new Rickshaw.Graph.Axis.Time(xAxisConfig);
158+
}
159+
else {
160+
xAxis = new Rickshaw.Graph.Axis.X(xAxisConfig);
161+
}
154162
xAxis.render();
155163
}
156164
else {

0 commit comments

Comments
 (0)