Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-68477

Charts API: support for legend options for Chart.js

    XMLWordPrintable

Details

    Description

      This patch branch provides a means to set legend options as per: https://www.chartjs.org/docs/2.7.0/configuration/legend.html

      It adds a field, setters and getters to the Base chart classes in PHP and Javascript. From Moodle, it is invoked via e.g.: $chart->set_legend_options(array('position' => 'bottom', 'reverse' => true))

      At this point, specifying onClick and onHover events is not directly supported via this method. Dynamically creating functions out of strings is not permitted by the ESLint no-new-func directive, and it's arguable as to whether that would be a good approach to take in the first place.

      Attachments

        Issue Links

          Activity

            People

              drcuriosity David Thompson
              drcuriosity David Thompson
              Simey Lameze Simey Lameze
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Janelle Barcega Janelle Barcega
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jun/20

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 25 minutes
                  2h 25m