@@ -247,16 +247,23 @@ class Events
247
247
struct Marker : Element
248
248
{
249
249
const Gen::Marker ▮
250
+ struct DataPosition
251
+ {
252
+ Geom::Point top;
253
+ Geom::Point center;
254
+ } position;
250
255
251
- explicit Marker (const Gen::Marker &marker) :
256
+ explicit Marker (const Gen::Marker &marker,
257
+ const DataPosition &position) :
252
258
Element(" plot-marker" ),
253
- marker(marker)
259
+ marker(marker),
260
+ position(position)
254
261
{}
255
262
256
263
void appendToJSON (Conv::JSONObj &&jsonObj) const override
257
264
{
258
- Element::appendToJSON (
259
- marker. appendToJSON ( std::move (jsonObj)));
265
+ Element::appendToJSON (marker. appendToJSON (
266
+ std::move (jsonObj))( " position " , position ));
260
267
}
261
268
};
262
269
@@ -268,8 +275,10 @@ class Events
268
275
{
269
276
bool horizontal;
270
277
271
- MarkerGuide (const Gen::Marker &marker, bool horizontal) :
272
- MarkerChild (" guide" , marker),
278
+ MarkerGuide (const Gen::Marker &marker,
279
+ const Marker::DataPosition &position,
280
+ bool horizontal) :
281
+ MarkerChild (" guide" , marker, position),
273
282
horizontal (horizontal)
274
283
{}
275
284
@@ -313,15 +322,19 @@ class Events
313
322
return std::make_unique<Legend>(properties);
314
323
}
315
324
316
- static auto marker (const Gen::Marker &marker)
325
+ static auto marker (const Gen::Marker &marker,
326
+ const Marker::DataPosition &position)
317
327
{
318
- return std::make_unique<Marker>(marker);
328
+ return std::make_unique<Marker>(marker, position );
319
329
}
320
330
321
331
static auto markerGuide (const Gen::Marker &marker,
332
+ const Marker::DataPosition &position,
322
333
bool horizontal)
323
334
{
324
- return std::make_unique<MarkerGuide>(marker, horizontal);
335
+ return std::make_unique<MarkerGuide>(marker,
336
+ position,
337
+ horizontal);
325
338
}
326
339
327
340
static auto root ()
@@ -362,11 +375,13 @@ class Events
362
375
}
363
376
364
377
static auto markerLabel (const std::string &label,
365
- const Gen::Marker &marker)
378
+ const Gen::Marker &marker,
379
+ const Marker::DataPosition &position)
366
380
{
367
381
return std::make_unique<Text<MarkerChild>>(label,
368
382
" label" ,
369
- marker);
383
+ marker,
384
+ position);
370
385
}
371
386
372
387
static auto dimLegendLabel (
0 commit comments