tideline 1.37.0-develop.1 → 1.37.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,7 +44,39 @@ function chartDailyFactory(el, options) {
44
44
  timePrefs: {
45
45
  timezoneAware: false,
46
46
  timezoneName: dt.getBrowserTimezone(),
47
- }
47
+ },
48
+ endpoints: null,
49
+ dayLabel: true,
50
+ pool: {
51
+ events: {
52
+ hidden: false,
53
+ label: true,
54
+ legend: true,
55
+ heightRatio: 0.5,
56
+ gutterWeight: 0
57
+ },
58
+ bg: {
59
+ hidden: false,
60
+ label: true,
61
+ legend: true,
62
+ heightRatio: 2.15,
63
+ gutterWeight: 1,
64
+ },
65
+ bolus: {
66
+ hidden: false,
67
+ label: true,
68
+ legend: true,
69
+ heightRatio: 1.35,
70
+ gutterWeight: 1,
71
+ },
72
+ basal: {
73
+ hidden: false,
74
+ label: true,
75
+ legend: true,
76
+ heightRatio: 1.0,
77
+ gutterWeight: 1,
78
+ },
79
+ },
48
80
  };
49
81
  _.defaults(options, defaults);
50
82
 
@@ -104,16 +136,16 @@ function chartDailyFactory(el, options) {
104
136
  .gutterWeight(0.0);
105
137
 
106
138
  // events pool
107
- poolEvents = chart.newPool()
139
+ if (!options.pool.events.hidden) poolEvents = chart.newPool(options.pool.events)
108
140
  .id('poolEvents', chart.poolGroup())
109
141
  .label('')
110
142
  .labelBaseline(options.labelBaseline)
111
143
  .index(chart.pools().indexOf(poolEvents))
112
- .heightRatio(0.5)
113
- .gutterWeight(0.0);
144
+ .heightRatio(options.pool.events.heightRatio)
145
+ .gutterWeight(options.pool.events.gutterWeight);
114
146
 
115
147
  // blood glucose data pool
116
- poolBG = chart.newPool()
148
+ if (!options.pool.bg.hidden) poolBG = chart.newPool(options.pool.bg)
117
149
  .id('poolBG', chart.poolGroup())
118
150
  .label([{
119
151
  'main': t('Glucose'),
@@ -122,11 +154,11 @@ function chartDailyFactory(el, options) {
122
154
  .labelBaseline(options.labelBaseline)
123
155
  .legend(['bg'])
124
156
  .index(chart.pools().indexOf(poolBG))
125
- .heightRatio(2.15)
126
- .gutterWeight(1.0);
157
+ .heightRatio(options.pool.bg.heightRatio)
158
+ .gutterWeight(options.pool.bg.gutterWeight);
127
159
 
128
160
  // carbs and boluses data pool
129
- poolBolus = chart.newPool()
161
+ if (!options.pool.bolus.hidden) poolBolus = chart.newPool(options.pool.bolus)
130
162
  .id('poolBolus', chart.poolGroup())
131
163
  .label([{
132
164
  'main': t('Bolus'),
@@ -139,11 +171,11 @@ function chartDailyFactory(el, options) {
139
171
  .labelBaseline(options.labelBaseline)
140
172
  .legend(bolusCarbsLegend)
141
173
  .index(chart.pools().indexOf(poolBolus))
142
- .heightRatio(1.35)
143
- .gutterWeight(1.0);
174
+ .heightRatio(options.pool.bolus.heightRatio)
175
+ .gutterWeight(options.pool.bolus.gutterWeight);
144
176
 
145
177
  // basal data pool
146
- poolBasal = chart.newPool()
178
+ if (!options.pool.basal.hidden) poolBasal = chart.newPool(options.pool.basal)
147
179
  .id('poolBasal', chart.poolGroup())
148
180
  .label([{
149
181
  main: t('Basal Rates'),
@@ -152,51 +184,51 @@ function chartDailyFactory(el, options) {
152
184
  .labelBaseline(options.labelBaseline)
153
185
  .legend(basalLegend)
154
186
  .index(chart.pools().indexOf(poolBasal))
155
- .heightRatio(1.0)
156
- .gutterWeight(1.0);
187
+ .heightRatio(options.pool.basal.heightRatio)
188
+ .gutterWeight(options.pool.basal.gutterWeight);
157
189
 
158
190
  chart.arrangePools();
159
191
 
160
192
  chart.setAnnotation().setTooltip();
161
193
 
162
194
  // add annotations
163
- chart.annotations().addGroup(chart.svg().select('#' + poolBG.id()), 'smbg');
164
- chart.annotations().addGroup(chart.svg().select('#' + poolBolus.id()), 'bolus');
165
- chart.annotations().addGroup(chart.svg().select('#' + poolBolus.id()), 'wizard');
166
- chart.annotations().addGroup(chart.svg().select('#' + poolBasal.id()), 'basal');
195
+ if (poolBG) chart.annotations().addGroup(chart.svg().select('#' + poolBG.id()), 'smbg');
196
+ if (poolBolus) chart.annotations().addGroup(chart.svg().select('#' + poolBolus.id()), 'bolus');
197
+ if (poolBolus) chart.annotations().addGroup(chart.svg().select('#' + poolBolus.id()), 'wizard');
198
+ if (poolBasal) chart.annotations().addGroup(chart.svg().select('#' + poolBasal.id()), 'basal');
167
199
 
168
200
  // add tooltips
169
- chart.tooltips().addGroup(poolEvents, {
201
+ if (poolEvents) chart.tooltips().addGroup(poolEvents, {
170
202
  type: 'deviceEvent',
171
203
  shape: 'generic'
172
204
  });
173
- chart.tooltips().addGroup(poolEvents, {
205
+ if (poolEvents) chart.tooltips().addGroup(poolEvents, {
174
206
  type: 'message',
175
207
  shape: 'generic'
176
208
  });
177
- chart.tooltips().addGroup(poolBG, {
209
+ if (poolBG) chart.tooltips().addGroup(poolBG, {
178
210
  type: 'cbg',
179
211
  classes: ['d3-bg-low', 'd3-bg-target', 'd3-bg-high']
180
212
  });
181
- chart.tooltips().addGroup(poolBG, {
213
+ if (poolBG) chart.tooltips().addGroup(poolBG, {
182
214
  type: 'smbg'
183
215
  });
184
- chart.tooltips().addGroup(poolBolus, {
216
+ if (poolBolus) chart.tooltips().addGroup(poolBolus, {
185
217
  type: 'wizard',
186
218
  shape: 'generic'
187
219
  });
188
- chart.tooltips().addGroup(poolBolus, {
220
+ if (poolBolus) chart.tooltips().addGroup(poolBolus, {
189
221
  type: 'bolus',
190
222
  shape: 'generic'
191
223
  });
192
- chart.tooltips().addGroup(poolBasal, {
224
+ if (poolBasal) chart.tooltips().addGroup(poolBasal, {
193
225
  type: 'basal'
194
226
  });
195
227
 
196
228
  return chart;
197
229
  };
198
230
 
199
- chart.load = function(data) {
231
+ chart.load = function(data, dataIsProcessed = false) {
200
232
  const renderedDataTypes = [
201
233
  'basal',
202
234
  'bolus',
@@ -208,23 +240,31 @@ function chartDailyFactory(el, options) {
208
240
  'wizard',
209
241
  ];
210
242
 
211
- const latestDatums = _.pick(_.get(data, 'metaData.latestDatumByType'), renderedDataTypes);
212
- const latestDatumTime = _.max(_.map(latestDatums, d => (d.normalEnd || d.normalTime)));
213
- const datumCeiling = dt.getLocalizedCeiling(latestDatumTime, _.get(chart.options.timePrefs, 'timezoneName', 'UTC'));
243
+ let processedData;
214
244
 
215
- const combinedData = _.reject(
216
- _.sortBy(_.cloneDeep(_.get(data, 'data.combined', [])), 'normalTime'),
217
- d => (d.normalTime >= datumCeiling)
218
- );
245
+ if (dataIsProcessed) {
246
+ processedData = data;
247
+ } else {
248
+ const latestDatums = _.pick(_.get(data, 'metaData.latestDatumByType'), renderedDataTypes);
249
+ const latestDatumTime = _.max(_.map(latestDatums, d => (d.normalEnd || d.normalTime)));
250
+ const datumCeiling = dt.getLocalizedCeiling(latestDatumTime, _.get(chart.options.timePrefs, 'timezoneName', 'UTC'));
219
251
 
220
- const groupedData = _.groupBy(combinedData, 'type');
252
+ processedData = _.reject(
253
+ _.sortBy(_.cloneDeep(_.get(data, 'data.combined', data?.data?.current?.data || [])), 'normalTime'),
254
+ d => (d.normalTime >= datumCeiling)
255
+ );
256
+ }
257
+
258
+ const groupedData = _.groupBy(processedData, 'type');
259
+ const groupedEventData = _.groupBy(_.filter(processedData, d => _.isString(d.tags?.event)), 'type');
221
260
 
222
261
  _.each(renderedDataTypes, type => {
223
262
  if (!groupedData[type]) groupedData[type] = [];
224
263
  });
225
264
 
226
265
  // initialize chart with data
227
- chart.data(combinedData).setAxes().setNav().setScrollNav();
266
+ chart.data(processedData).setAxes();
267
+ if (!options.endpoints) chart.setNav().setScrollNav();
228
268
 
229
269
  // x-axis pools
230
270
  // add ticks to top x-axis pool
@@ -232,180 +272,206 @@ function chartDailyFactory(el, options) {
232
272
  'class': 'd3-top',
233
273
  emitter: emitter,
234
274
  leftEdge: chart.axisGutter(),
235
- timePrefs: chart.options.timePrefs
236
- }), true, true);
237
-
238
- // BG pool
239
-
240
- const allBG = _.filter(combinedData, d => (d.type === 'cbg' || d.type === 'smbg'));
241
- var scaleBG = scales.bg(allBG, poolBG, SMBG_SIZE/2);
242
- var bgTickFormat = options.bgUnits === MGDL_UNITS ? 'd' : '.1f';
243
-
244
- // set up y-axis
245
- poolBG.yAxis(d3.svg.axis()
246
- .scale(scaleBG)
247
- .orient('left')
248
- .outerTickSize(0)
249
- .tickValues(scales.bgTicks(allBG))
250
- .tickFormat(d3.format(bgTickFormat)));
251
- // add background fill rectangles to BG pool
252
- poolBG.addPlotType('fill', fill(poolBG, {
253
- endpoints: chart.endpoints,
254
- isDaily: true,
255
- guidelines: [
256
- {
257
- 'class': 'd3-line-bg-threshold',
258
- 'height': chart.options.bgClasses.low.boundary
259
- },
260
- {
261
- 'class': 'd3-line-bg-threshold',
262
- 'height': chart.options.bgClasses.target.boundary
263
- }
264
- ],
265
- yScale: scaleBG
266
- }), true, true);
267
-
268
- // add CBG data to BG pool
269
- poolBG.addPlotType('cbg', tideline.plot.cbg(poolBG, {
270
- bgUnits: chart.options.bgUnits,
271
- classes: chart.options.bgClasses,
272
- yScale: scaleBG,
273
- timezoneAware: chart.options.timePrefs.timezoneAware,
274
- onCBGHover: options.onCBGHover,
275
- onCBGOut: options.onCBGOut,
275
+ timePrefs: chart.options.timePrefs,
276
+ dayLabel: options.dayLabel,
276
277
  }), true, true);
277
278
 
278
- // add SMBG data to BG pool
279
- poolBG.addPlotType('smbg', tideline.plot.smbg(poolBG, {
280
- bgUnits: chart.options.bgUnits,
281
- classes: chart.options.bgClasses,
282
- yScale: scaleBG,
283
- timezoneAware: chart.options.timePrefs.timezoneAware,
284
- onSMBGHover: options.onSMBGHover,
285
- onSMBGOut: options.onSMBGOut,
286
- }), true, true);
287
-
288
- // TODO: when we bring responsiveness in
289
- // decide number of ticks for these scales based on container height?
290
- // bolus & carbs pool
291
- var scaleBolus = scales.bolus(groupedData.bolus.concat(groupedData.wizard), poolBolus);
292
- var scaleCarbs = options.dynamicCarbs ? scales.carbs(groupedData.wizard, poolBolus) : null;
293
- // set up y-axis for bolus
294
- poolBolus.yAxis(d3.svg.axis()
295
- .scale(scaleBolus)
296
- .orient('left')
297
- .outerTickSize(0)
298
- .ticks(2));
299
-
300
- // add background fill rectangles to bolus pool
301
- var scaleHeight = d3.scale.linear()
302
- .domain([0, poolBolus.height()])
303
- .range([0, poolBolus.height()]);
304
-
305
- poolBolus.addPlotType('fill', fill(poolBolus, {
306
- endpoints: chart.endpoints,
307
- isDaily: true,
308
- yScale: scaleHeight
309
- }), true, true);
310
-
311
- // add wizard data to wizard pool
312
- poolBolus.addPlotType('wizard', tideline.plot.wizard(poolBolus, {
313
- yScale: scaleBolus,
314
- yScaleCarbs: scaleCarbs,
315
- emitter: emitter,
316
- subdueOpacity: 0.4,
317
- timezoneAware: chart.options.timePrefs.timezoneAware,
318
- onBolusHover: options.onBolusHover,
319
- onBolusOut: options.onBolusOut,
320
- }), true, true);
321
-
322
- poolBolus.addPlotType('food', tideline.plot.carb(poolBolus, {
323
- emitter: emitter,
324
- timezoneAware: chart.options.timePrefs.timezoneAware,
325
- onCarbHover: options.onCarbHover,
326
- onCarbOut: options.onCarbOut,
327
- }), true, true);
328
-
329
- // quick bolus data to wizard pool
330
- poolBolus.addPlotType('bolus', tideline.plot.quickbolus(poolBolus, {
331
- yScale: scaleBolus,
332
- emitter: emitter,
333
- subdueOpacity: 0.4,
334
- timezoneAware: chart.options.timePrefs.timezoneAware,
335
- onBolusHover: options.onBolusHover,
336
- onBolusOut: options.onBolusOut,
337
- }), true, true);
338
-
339
- // basal pool
340
- var scaleBasal = scales.basal(groupedData.basal, poolBasal);
341
- // set up y-axis
342
- poolBasal.yAxis(d3.svg.axis()
343
- .scale(scaleBasal)
344
- .orient('left')
345
- .outerTickSize(0)
346
- .ticks(2));
347
- // add background fill rectangles to basal pool
348
- poolBasal.addPlotType('fill', fill(poolBasal, {endpoints: chart.endpoints, isDaily: true}), true, true);
349
-
350
- // add basal data to basal pool
351
- poolBasal.addPlotType('basal', tideline.plot.basal(poolBasal, {
352
- yScale: scaleBasal,
353
- emitter: emitter,
354
- data: groupedData.basal,
355
- timezoneAware: chart.options.timePrefs.timezoneAware
356
- }), true, true);
357
-
358
- // add device suspend data to basal pool
359
- poolBasal.addPlotType('deviceEvent', tideline.plot.suspend(poolBasal, {
360
- yScale: scaleBasal,
361
- emitter: emitter,
362
- data: groupedData.deviceEvent,
363
- timezoneAware: chart.options.timePrefs.timezoneAware
364
- }), true, true);
365
-
366
- // add device settings override data to basal pool
367
- poolBasal.addPlotType('deviceEvent', tideline.plot.pumpSettingsOverride(poolBasal, {
368
- yScale: scaleBasal,
369
- emitter: emitter,
370
- data: groupedData.deviceEvent,
371
- timezoneAware: chart.options.timePrefs.timezoneAware,
372
- timezoneName: chart.options.timePrefs.timezoneName,
373
- onPumpSettingsOverrideHover: options.onPumpSettingsOverrideHover,
374
- onPumpSettingsOverrideOut: options.onPumpSettingsOverrideOut,
375
- }), true, true);
376
-
377
- // events pool
378
- // add background fill rectangles to events pool
379
- poolEvents.addPlotType('fill', fill(poolEvents, {
380
- emitter: emitter,
381
- isDaily: true,
382
- cursor: 'cell'
383
- }), true, true);
279
+ if (poolBG) {
280
+ // BG pool
281
+ let allBG = _.filter(processedData, d => (d.type === 'cbg' || d.type === 'smbg'));
282
+
283
+ // Use a dummy BG value when there is no BG data to ensure that the scale is created properly
284
+ if (allBG.length === 0) allBG = [{ value: scales.TARGET_BG_BOUNDARY }];
285
+
286
+ var scaleBG = scales.bg(allBG, poolBG, SMBG_SIZE/2);
287
+ var bgTickFormat = options.bgUnits === MGDL_UNITS ? 'd' : '.1f';
288
+
289
+ // set up y-axis
290
+ poolBG.yAxis(d3.svg.axis()
291
+ .scale(scaleBG)
292
+ .orient('left')
293
+ .outerTickSize(0)
294
+ .tickValues(scales.bgTicks(allBG))
295
+ .tickFormat(d3.format(bgTickFormat)));
296
+
297
+ // add background fill rectangles to BG pool
298
+ poolBG.addPlotType('fill', fill(poolBG, {
299
+ endpoints: chart.endpoints,
300
+ isDaily: true,
301
+ guidelines: [
302
+ {
303
+ 'class': 'd3-line-bg-threshold',
304
+ 'height': chart.options.bgClasses.low.boundary
305
+ },
306
+ {
307
+ 'class': 'd3-line-bg-threshold',
308
+ 'height': chart.options.bgClasses.target.boundary
309
+ }
310
+ ],
311
+ yScale: scaleBG
312
+ }), true, true);
313
+
314
+ // add CBG data to BG pool
315
+ poolBG.addPlotType('cbg', tideline.plot.cbg(poolBG, {
316
+ bgUnits: chart.options.bgUnits,
317
+ classes: chart.options.bgClasses,
318
+ yScale: scaleBG,
319
+ chartEndpoints: chart.endpoints,
320
+ timezoneAware: chart.options.timePrefs.timezoneAware,
321
+ onCBGHover: options.onCBGHover,
322
+ onCBGOut: options.onCBGOut,
323
+ }), true, true);
324
+
325
+ // add SMBG data to BG pool
326
+ poolBG.addPlotType('smbg', tideline.plot.smbg(poolBG, {
327
+ bgUnits: chart.options.bgUnits,
328
+ classes: chart.options.bgClasses,
329
+ yScale: scaleBG,
330
+ chartEndpoints: chart.endpoints,
331
+ timezoneAware: chart.options.timePrefs.timezoneAware,
332
+ onSMBGHover: options.onSMBGHover,
333
+ onSMBGOut: options.onSMBGOut,
334
+ }), true, true);
335
+ }
384
336
 
385
- // add message images to events pool
386
- poolEvents.addPlotType('message', tideline.plot.message(poolEvents, {
387
- size: 30,
388
- emitter: emitter,
389
- timezoneAware: chart.options.timePrefs.timezoneAware
390
- }), true, true);
337
+ if (poolBolus) {
338
+ // bolus & carbs pool
339
+ var scaleBolus = scales.bolus(groupedData.bolus.concat(groupedData.wizard), poolBolus);
340
+ var scaleCarbs = options.dynamicCarbs ? scales.carbs(groupedData.wizard, poolBolus) : null;
341
+ // set up y-axis for bolus
342
+ poolBolus.yAxis(d3.svg.axis()
343
+ .scale(scaleBolus)
344
+ .orient('left')
345
+ .outerTickSize(0)
346
+ .ticks(2));
347
+
348
+ // add background fill rectangles to bolus pool
349
+ var scaleHeight = d3.scale.linear()
350
+ .domain([0, poolBolus.height()])
351
+ .range([0, poolBolus.height()]);
352
+
353
+ poolBolus.addPlotType('fill', fill(poolBolus, {
354
+ endpoints: chart.endpoints,
355
+ isDaily: true,
356
+ yScale: scaleHeight
357
+ }), true, true);
358
+
359
+ // add wizard data to wizard pool
360
+ poolBolus.addPlotType('wizard', tideline.plot.wizard(poolBolus, {
361
+ yScale: scaleBolus,
362
+ yScaleCarbs: scaleCarbs,
363
+ emitter: emitter,
364
+ subdueOpacity: 0.4,
365
+ timezoneAware: chart.options.timePrefs.timezoneAware,
366
+ onBolusHover: options.onBolusHover,
367
+ onBolusOut: options.onBolusOut,
368
+ }), true, true);
369
+
370
+ poolBolus.addPlotType('food', tideline.plot.carb(poolBolus, {
371
+ emitter: emitter,
372
+ timezoneAware: chart.options.timePrefs.timezoneAware,
373
+ onCarbHover: options.onCarbHover,
374
+ onCarbOut: options.onCarbOut,
375
+ }), true, true);
376
+
377
+ // quick bolus data to wizard pool
378
+ poolBolus.addPlotType('bolus', tideline.plot.quickbolus(poolBolus, {
379
+ yScale: scaleBolus,
380
+ emitter: emitter,
381
+ subdueOpacity: 0.4,
382
+ timezoneAware: chart.options.timePrefs.timezoneAware,
383
+ onBolusHover: options.onBolusHover,
384
+ onBolusOut: options.onBolusOut,
385
+ }), true, true);
386
+ }
391
387
 
392
- // add timechange images to events pool
393
- poolEvents.addPlotType('deviceEvent', tideline.plot.timechange(poolEvents, {
394
- size: 30,
395
- emitter: emitter,
396
- timezone: chart.options.timePrefs.timezoneName
397
- }), true, true);
388
+ if (poolBasal) {
389
+ // basal pool
390
+ var scaleBasal = scales.basal(groupedData.basal, poolBasal);
391
+ // set up y-axis
392
+ poolBasal.yAxis(d3.svg.axis()
393
+ .scale(scaleBasal)
394
+ .orient('left')
395
+ .outerTickSize(0)
396
+ .ticks(2));
397
+ // add background fill rectangles to basal pool
398
+ poolBasal.addPlotType('fill', fill(poolBasal, {endpoints: chart.endpoints, isDaily: true}), true, true);
399
+
400
+ // add basal data to basal pool
401
+ poolBasal.addPlotType('basal', tideline.plot.basal(poolBasal, {
402
+ yScale: scaleBasal,
403
+ emitter: emitter,
404
+ data: groupedData.basal,
405
+ timezoneAware: chart.options.timePrefs.timezoneAware
406
+ }), true, true);
407
+
408
+ // add device suspend data to basal pool
409
+ poolBasal.addPlotType('deviceEvent', tideline.plot.suspend(poolBasal, {
410
+ yScale: scaleBasal,
411
+ emitter: emitter,
412
+ data: groupedData.deviceEvent,
413
+ timezoneAware: chart.options.timePrefs.timezoneAware
414
+ }), true, true);
415
+
416
+ // add device settings override data to basal pool
417
+ poolBasal.addPlotType('deviceEvent', tideline.plot.pumpSettingsOverride(poolBasal, {
418
+ yScale: scaleBasal,
419
+ emitter: emitter,
420
+ data: groupedData.deviceEvent,
421
+ timezoneAware: chart.options.timePrefs.timezoneAware,
422
+ timezoneName: chart.options.timePrefs.timezoneName,
423
+ onPumpSettingsOverrideHover: options.onPumpSettingsOverrideHover,
424
+ onPumpSettingsOverrideOut: options.onPumpSettingsOverrideOut,
425
+ }), true, true);
426
+ }
398
427
 
399
- // add pump alarm data to events pool
400
- poolEvents.addPlotType('deviceEvent', tideline.plot.alarm(poolEvents, {
401
- size: 23,
402
- emitter: emitter,
403
- data: groupedData.deviceEvent,
404
- timezoneAware: chart.options.timePrefs.timezoneAware,
405
- timezoneName: chart.options.timePrefs.timezoneName,
406
- onAlarmHover: options.onAlarmHover,
407
- onAlarmOut: options.onAlarmOut,
408
- }), true, true);
428
+ if (poolEvents) {
429
+ // events pool
430
+ // add background fill rectangles to events pool
431
+ poolEvents.addPlotType('fill', fill(poolEvents, {
432
+ emitter: emitter,
433
+ isDaily: true,
434
+ cursor: 'cell'
435
+ }), true, true);
436
+
437
+ // add message images to events pool
438
+ poolEvents.addPlotType('message', tideline.plot.message(poolEvents, {
439
+ size: 30,
440
+ emitter: emitter,
441
+ timezoneAware: chart.options.timePrefs.timezoneAware
442
+ }), true, true);
443
+
444
+ // add timechange images to events pool
445
+ poolEvents.addPlotType('deviceEvent', tideline.plot.timechange(poolEvents, {
446
+ size: 30,
447
+ emitter: emitter,
448
+ timezone: chart.options.timePrefs.timezoneName
449
+ }), true, true);
450
+
451
+ // add pump alarm data to events pool
452
+ poolEvents.addPlotType('deviceEvent', tideline.plot.alarm(poolEvents, {
453
+ size: 23,
454
+ emitter: emitter,
455
+ data: groupedData.deviceEvent,
456
+ timezoneAware: chart.options.timePrefs.timezoneAware,
457
+ timezoneName: chart.options.timePrefs.timezoneName,
458
+ onAlarmHover: options.onAlarmHover,
459
+ onAlarmOut: options.onAlarmOut,
460
+ }), true, true);
461
+
462
+ // add pump events data to events pool
463
+ _.each(groupedEventData, function(data, type) {
464
+ poolEvents.addPlotType(type, tideline.plot.event(poolEvents, {
465
+ size: 18,
466
+ emitter: emitter,
467
+ data: data,
468
+ timezoneAware: chart.options.timePrefs.timezoneAware,
469
+ timezoneName: chart.options.timePrefs.timezoneName,
470
+ onEventHover: options.onEventHover,
471
+ onEventOut: options.onEventOut,
472
+ }), true, true);
473
+ });
474
+ }
409
475
 
410
476
  return chart;
411
477
  };
@@ -461,7 +527,7 @@ function chartDailyFactory(el, options) {
461
527
  pool.render(chart.poolGroup(), chart.renderedData());
462
528
  });
463
529
 
464
- chart.setAtDate(start, atMostRecent);
530
+ if (!options.endpoints) chart.setAtDate(start, atMostRecent);
465
531
 
466
532
  return chart;
467
533
  };
@@ -40,7 +40,7 @@ function chartWeeklyFactory(el, options) {
40
40
  timePrefs: {
41
41
  timezoneAware: false,
42
42
  timezoneName: dt.getBrowserTimezone(),
43
- }
43
+ },
44
44
  };
45
45
  _.defaults(options, defaults);
46
46