Hitachi Vantara Pentaho Community Forums
Results 1 to 1 of 1

Thread: Bar Chart With Trimmed X-Axis Labels

  1. #1

    Unhappy Bar Chart With Trimmed X-Axis Labels

    hey guys
    I'm trying to implement this fiddle http://jsfiddle.net/duarteleao/k703wqmo/ to trim x-axis labels, but my chart isn't rendered if I add the baseAxisLabel_text extension point.
    Does anybody have an idea what I'm doing wrong here?
    If I remove the extension point reference, the chart is rendered.

    Thanks!

    Code:
    var chart_grupo_data = {
              "resultset": [],
              "metadata": [{
                "colIndex": 0,
                "colType": "String",
                "colName": "Unidade"
              },{
                "colIndex": 1,
                "colType": "Numeric",
                "colName": "Qt Espera Menor 20min"
              },{
                "colIndex": 2,
                "colType": "Numeric",
                "colName": "Qt Espera Maior 20min"
              }]
        };
    chart_grupo_data.resultset = eval(grupo_sparkline);
        new pvc.BarChart({
            canvas: 'chartEsperaUnidade',
            width:  800,
            height: 400,
            
            // Data source
            crosstabMode: true,
    
    
            // Interaction
            animate:    true,
            selectable: false,
            hoverable:  true,
            valuesOptimizeLegibility: true,
            valuesFont: 'lighter 11px "Roboto"',
    
    
            // Cartesian Axes
            baseAxisTicks: true,
            baseAxisTooltipAutoContent: 'summary',
            axisRule_strokeStyle: '#DDDDDD',
            baseAxisLabelSpacingMin: 1,
            baseAxisOverlappedLabelsMode: 'leave',
            extensionPoints: {
               baseAxisLabel_text: function(a) {
                var text = this.vars.tick.label;
                var panel = this.panel;
                var font = panel.font;
                var step = panel.scale.range().step;
                var spacingMin = panel._layoutInfo.textHeight *
                                 panel.labelSpacingMin /* em */;
                var availableSpace = step - spacingMin;
                return pvc.text.trimToWidthB(availableSpace, text, font, "..", false);
              }
            }
        }).setData(chart_grupo_data)
          .render();
    Last edited by alexsousa; 10-18-2017 at 12:22 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.