Skip to content

Commit 85d0071

Browse files
committed
fixes
1 parent a20387b commit 85d0071

3 files changed

Lines changed: 35 additions & 32 deletions

File tree

dist/widgets.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "widgets",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"description": "",
55
"main": "dist/widgets.js",
66
"directories": {

src/components/chart_by_time.vue

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
it.dRevert.innerHTML='Revert zoom';
9292
it.dRevert.style.position = "absolute";
9393
it.dRevert.style.zIndex = 1000;
94-
it.dRevert.style.top = '10px';
94+
it.dRevert.style.bottom = '15px';
9595
it.dRevert.style.right = '10px';
9696
it.dRevert.style.borderRadius = '0.25rem';
9797
it.dRevert.style.border = it.context.theme == 'dark' ? '1px solid #758591' : '1px solid black';
@@ -101,7 +101,8 @@
101101
it.dRevert.addEventListener('click', function(e){
102102
it.hasInnerRequest = true;
103103
// last
104-
it.context.query.request(_.first(it.historyRequests), function (data, his) {
104+
let firstHistoryRequest = _.first(it.historyRequests);
105+
it.context.query.request({from: firstHistoryRequest.from, till: firstHistoryRequest.till}, function (data, his) {
105106
it.hasInnerRequest = true;
106107
// it.historyRequests.pop();
107108
it.historyRequests = [];
@@ -133,15 +134,17 @@
133134
"</select>";
134135
it.dFormat.style.position = "absolute";
135136
it.dFormat.style.zIndex = 1000;
136-
it.dFormat.style.top = '10px';
137-
it.dFormat.style.left = '10px';
137+
it.dFormat.style.bottom = '15px';
138+
it.dFormat.style.left = '0';
139+
it.dFormat.style.width = '100%';
140+
it.dFormat.style.textAlign = 'center';
138141
it.$el.appendChild(it.dFormat);
139142
it.dFormat.querySelector('select').addEventListener('change', function(e){
140-
if (Array.isArray(it.historyRequests)){
141-
it.historyRequests.push(it.context.query.variables);
142-
}else{
143-
it.historyRequests = [it.context.query.variables];
144-
}
143+
// if (Array.isArray(it.historyRequests)){
144+
// it.historyRequests.push(it.context.query.variables);
145+
// }else{
146+
// it.historyRequests = [it.context.query.variables];
147+
// }
145148
it.hasInnerRequest = true;
146149
it.context.query.request({dateFormat: e.target.value}, function (data, his) {
147150
it.hasInnerRequest = true;
@@ -180,7 +183,7 @@
180183
case 'datetime':
181184
// ISO 8601 — 2014-12-06T10:30:00-0800
182185
// tmp_data = moment(tmp_data);
183-
tmp_data = {v: new Date(tmp_data), f: it.setPattern(tmp_data, it.context.query.variables.dateFormat)};
186+
tmp_data = it.setPattern(tmp_data, it.context.query.variables.dateFormat);
184187
break;
185188
case 'timeofday':
186189
// 8:30am would be: [8, 30, 0, 0]
@@ -200,14 +203,14 @@
200203
setPattern: function(date, dateFormat){
201204
switch(dateFormat){
202205
case '%Y':
203-
return moment(date).format('YYYY');
206+
return {v: moment(date).toDate(), f: moment.utc(date).format('YYYY')};
204207
break;
205208
case '%Y-%m':
206-
return moment(date).format('MMM YYYY');
209+
return {v: moment(date).toDate(), f: moment.utc(date).format('MMM YYYY')};
207210
break;
208211
case '%Y-%m-%d':
209212
default:
210-
return moment(date).format('MMM DD, YYYY');
213+
return {v: moment(date).toDate(), f: moment(date).format('MMM DD, YYYY')};
211214
}
212215
},
213216
setTill: function(till, dateFormat){
@@ -228,10 +231,10 @@
228231
case '%Y':
229232
return {
230233
hAxis:{
231-
title: 'Years',
234+
// title: 'Years',
232235
format: 'yyyy',
233236
gridlines: {
234-
interval: [1],
237+
// interval: [1],
235238
units: {
236239
years: {format: ['yyyy']},
237240
// months: {format: ['MM/yy']},
@@ -244,61 +247,61 @@
244247
months: {format: [' ']},
245248
days: {format: [' ']},
246249
},
247-
color: 'grey',
250+
color: 'transparent',
248251
}
249252
}
250253
};
251254
break;
252255
case '%Y-%m-%d':
253256
return {
254257
hAxis:{
255-
title: 'Days',
258+
// title: 'Days',
256259
format: 'dd/MM/yy',
257260
gridlines: {
258261
units: {
259262
years: {format: ['yyyy']},
260263
months: {format: ['MM/yy']},
261-
days: {format: ['dd']},
264+
days: {format: ['dd/MM/yy']},
262265
},
263266
},
264267
minorGridlines: {
265268
units: {
266-
years: {format: ['yyyy']},
267-
months: {format: ['MM']},
268-
days: {format: ['dd']},
269+
years: {format: [' ']},
270+
months: {format: [' ']},
271+
days: {format: [' ']},
269272
},
270-
color: 'grey',
273+
color: 'transparent',
271274
}
272275
}
273276
};
274277
break;
275278
case '%Y-%m-%dT%H':
276279
return {
277280
hAxis:{
278-
title: 'Hours'
281+
// title: 'Hours'
279282
}
280283
};
281284
break;
282285
case '%Y-%m':
283286
default:
284287
return {
285288
hAxis:{
286-
title: 'Months',
287-
format: 'dd/MM/yy',
289+
// title: 'Months',
290+
format: 'MM/yy',
288291
gridlines: {
289292
units: {
290293
years: {format: ['yyyy']},
291294
months: {format: ['MM/yy']},
292-
days: {format: ['dd']},
295+
days: {format: [' ']},
293296
},
294297
},
295298
minorGridlines: {
296299
units: {
297-
years: {format: ['yyyy']},
298-
months: {format: ['MM']},
299-
days: {format: ['dd']},
300+
years: {format: [' ']},
301+
months: {format: [' ']},
302+
days: {format: [' ']},
300303
},
301-
color: 'grey',
304+
color: 'transparent',
302305
}
303306
}
304307
};

0 commit comments

Comments
 (0)