Skip to content

Chart height

Available since v3.0.2

Live Sample · GitHub

maxRows sets the height of a chart in rows of a standard form. A row is 88 px: the label, the field and the gaps of one form field. A chart with maxRows stands level with a form of the same number of rows next to it.

Without maxRows the chart keeps its own height, as before. A value that is not a positive whole number is ignored, and the widget writes a message to the browser console.

This function is available for:

How does it look?

chartheight_column2d.png

chartheight_line2d.png

chartheight_dualaxes2d.png

chartheight_pie1d.png

chartheight_relationgraph.png

How to add?

Example

Add maxRows to the options of the chart in .widget.json. The options have their own key in each type of the widget:

Widget Option
Column2D options.chart2D.maxRows
Line2D options.chart2D.maxRows
DualAxes2D options.dual2D.maxRows
Pie1D options.chart1D.maxRows
RelationGraph options.relationGraph.maxRows
Funnel options.funnelOptions.maxRows
RingProgress options.ringProgressOptions.maxRows

{
  "name": "myexamplecolumnd",
  "title": "Sales per client",
  "type": "ColumnD",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "Client",
      "key": "clientName",
      "type": "input"
    },
    {
      "title": "Sum, $",
      "key": "sum",
      "type": "number"
    }
  ],
  "options": {
    "chartD": {
      "xValueFieldKey": "clientName",
      "yValueFieldKey": "sum",
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexamplelined",
  "title": "Sales sum per month",
  "type": "LineD",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "Month",
      "key": "month",
      "type": "input"
    },
    {
      "title": "Sum, $",
      "key": "sum",
      "type": "number"
    }
  ],
  "options": {
    "chartD": {
      "xValueFieldKey": "month",
      "yValueFieldKey": "sum",
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexampledualaxesd",
  "title": "Sales sum and number of sales per month",
  "type": "DualAxesD",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "Month",
      "key": "month",
      "type": "input"
    },
    {
      "title": "Product",
      "key": "productName",
      "type": "input"
    },
    {
      "title": "Sum, $",
      "key": "sum",
      "type": "number"
    },
    {
      "title": "Number of sales",
      "key": "count",
      "type": "number"
    }
  ],
  "options": {
    "dualD": {
      "widgets": [
        "myexampledualcolumnd",
        "myexampleduallined"
      ],
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexamplepied",
  "title": "Sales per client",
  "type": "PieD",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "Sales",
      "key": "value",
      "type": "number"
    },
    {
      "title": "Client",
      "key": "title",
      "type": "input"
    }
  ],
  "options": {
    "chartD": {
      "valueFieldKey": "value",
      "titleFieldKey": "title",
      "total": {
        "func": "sum",
        "description": "Total"
      },
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexamplerelationgraph",
  "title": "Sales network",
  "type": "RelationGraph",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "Parent company id",
      "key": "sourceNodeId",
      "type": "input"
    },
    {
      "title": "Company id",
      "key": "targetNodeId",
      "type": "input"
    },
    {
      "title": "Company",
      "key": "targetNodeName",
      "type": "input"
    },
    {
      "title": "Expanded",
      "key": "targetNodeExpanded",
      "type": "hidden"
    },
    {
      "title": "Sum, $",
      "key": "edgeValue",
      "type": "number"
    }
  ],
  "options": {
    "relationGraph": {
      "nodes": {
        "descriptionFieldKeys": [
          "targetNodeName"
        ]
      },
      "edges": {
        "labelFieldKeys": [
          "edgeValue"
        ]
      },
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexamplefunnel",
  "title": "Funnel widget",
  "type": "Funnel",
  "bc": "myExampleBc",
  "fields": [
    {
      "key": "funnelKey",
      "type": "input"
    },
    {
      "key": "amount",
      "type": "number"
    },
    {
      "key": "color",
      "type": "number"
    }
  ],
  "options": {
    "funnelOptions": {
      "maxRows": 3
    }
  }
}
Live Sample · GitHub

{
  "name": "myexampleringprogress",
  "title": "RingProgress",
  "type": "RingProgress",
  "bc": "myExampleBc",
  "fields": [
    {
      "title": "",
      "key": "value",
      "type": "number"
    },
    {
      "title": "",
      "key": "title",
      "type": "input"
    },
    {
      "title": "description",
      "key": "description",
      "type": "hint"
    }
  ],
  "options": {
    "ringProgressOptions": {
      "text": "Sum test",
      "percentField": "value",
      "numberField": "value",
      "descriptionField": "description",
      "maxRows": 3
    }
  }
}
Live Sample · GitHub