@@ -34,6 +34,7 @@ class LarapexChart
34
34
protected string $ grid ;
35
35
protected string $ markers ;
36
36
protected bool $ stacked = false ;
37
+ protected bool $ showLegend = true ;
37
38
protected string $ stroke = '' ;
38
39
protected string $ toolbar ;
39
40
protected string $ zoom ;
@@ -278,6 +279,12 @@ public function setStacked(bool $stacked = true): LarapexChart
278
279
return $ this ;
279
280
}
280
281
282
+ public function setShowLegend (bool $ showLegend = true ): self
283
+ {
284
+ $ this ->showLegend = $ showLegend ;
285
+ return $ this ;
286
+ }
287
+
281
288
/*
282
289
|--------------------------------------------------------------------------
283
290
| Getters
@@ -417,6 +424,11 @@ public function stacked(): bool
417
424
return $ this ->stacked ;
418
425
}
419
426
427
+ public function showLegend (): string
428
+ {
429
+ return $ this ->showLegend ? 'true ' : 'false ' ;
430
+ }
431
+
420
432
/*
421
433
|--------------------------------------------------------------------------
422
434
| JSON Options Builder
@@ -458,6 +470,9 @@ public function toJson(): \Illuminate\Http\JsonResponse
458
470
],
459
471
'grid ' => json_decode ($ this ->grid ()),
460
472
'markers ' => json_decode ($ this ->markers ()),
473
+ 'legend ' => [
474
+ 'show ' => $ this ->showLegend ()
475
+ ],
461
476
];
462
477
463
478
if ($ this ->labels ()) {
@@ -512,6 +527,9 @@ public function toVue() :array
512
527
],
513
528
'grid ' => json_decode ($ this ->grid ()),
514
529
'markers ' => json_decode ($ this ->markers ()),
530
+ 'legend ' => [
531
+ 'show ' => $ this ->showLegend ()
532
+ ]
515
533
];
516
534
517
535
if ($ this ->labels ()) {
0 commit comments