Widget:Chartjs bar: Difference between revisions

From Visual Data Wiki
Jump to navigation Jump to search
No edit summary
Tag: 2017 source edit
No edit summary
Tag: 2017 source edit
Line 38: Line 38:
     let title = '<!--{$title|default:''}-->';
     let title = '<!--{$title|default:''}-->';
     let legend = '<!--{$legend|default:'yes'}-->';
     let legend = '<!--{$legend|default:'yes'}-->';
    let orientation = '<!--{$legend|default:''}-->';


     dataIdentifier = dataIdentifier.trim();
     dataIdentifier = dataIdentifier.trim();
Line 48: Line 49:
     }
     }


     function drawPieChart(ctx, labels, dataIdentifier, colors, dataSeries, legend, title) {
    if (orientation === 'horizontal') {
        indexAxis = 'y';
    } else {
        indexAxis = 'x';
    }
 
     function drawPieChart(ctx, labels, dataIdentifier, colors, dataSeries, indexAxis, legend, title) {
       //console.log('ctx: ' + ctx);
       //console.log('ctx: ' + ctx);
       //console.log('labels: ' + labels);
       //console.log('labels: ' + labels);
Line 68: Line 75:
         options: {
         options: {
           responsive: true,
           responsive: true,
indexAxis: 'y',
          indexAxis: indexAxis,
           legend: { display: legend },
           legend: { display: legend },
           title: {
           title: {
Line 78: Line 85:
     }
     }


     window.drawPieChart = drawPieChart(ctx, labels, dataIdentifier, colors, dataSeries, legend, title);
     window.drawPieChart = drawPieChart(ctx, labels, dataIdentifier, colors, dataSeries, indexAxis, legend, title);


   });
   });

Revision as of 11:11, 19 March 2024

This widget allows you to add ... widget to your wiki page.

Created by [idea-sketch.com idea-sketch.com]

Using this widget[edit source]

For information on how to use this widget, see ...

Copy to your site[edit source]

To use this widget on your site, just install MediaWiki Widgets extension and copy the full source code of this page to your wiki as page Widget:Chartjs bar.