diff --git a/grafonnet/pie_chart_panel.libsonnet b/grafonnet/pie_chart_panel.libsonnet index 11719e10..aa8519e8 100644 --- a/grafonnet/pie_chart_panel.libsonnet +++ b/grafonnet/pie_chart_panel.libsonnet @@ -9,6 +9,17 @@ * @param title The title of the pie chart panel. * @param description (default `''`) Description of the panel * @param span (optional) Width of the panel + * @param breakPoint (optional) breakPoint + * @param cacheTimeout (optional) cacheTimeout + * @param combine_label (default `'Others'`) + * @param combine_threshold (default `0`) + * @param decimals (default `null`) Number of decimal places to show + * @param timeFrom (default `null`) + * @param timeShift (default `null`) + * @param legend_header (optional) legend header + * @param legend_sort (default `'avg'`) + * @param legend_sortDesc (default `true`) sort descending + * @param format (default `'short'`) unit * @param min_span (optional) Min span * @param datasource (optional) Datasource * @param aliasColors (optional) Define color mappings @@ -28,6 +39,17 @@ title, description='', span=null, + breakPoint=null, + cacheTimeout=null, + combine_label='Others', + combine_threshold=0, + decimals=null, + timeFrom=null, + timeShift=null, + legend_header='', + legend_sort='avg', + legend_sortDesc=true, + format='short', min_span=null, datasource=null, height=null, @@ -45,6 +67,16 @@ [if description != null then 'description']: description, pieType: pieType, title: title, + breakPoint: breakPoint, + cacheTimeout: cacheTimeout, + decimals: decimals, + format: format, + combine: { + label: combine_label, + threshold: combine_threshold, + }, + timeFrom: timeFrom, + timeShift: timeShift, aliasColors: aliasColors, [if span != null then 'span']: span, [if min_span != null then 'minSpan']: min_span, @@ -55,9 +87,12 @@ valueName: valueName, datasource: datasource, legend: { + [if legend_header != null then 'header']: legend_header, + sort: legend_sort, + sortDesc: legend_sortDesc, show: showLegend, values: true, - percentage: showLegendPercentage, + [if showLegendPercentage != null then 'percentage']: showLegendPercentage, }, legendType: legendType, targets: [ diff --git a/tests/pie_chart_panel/test_compiled.json b/tests/pie_chart_panel/test_compiled.json index ca0be8dc..6f8ba0aa 100644 --- a/tests/pie_chart_panel/test_compiled.json +++ b/tests/pie_chart_panel/test_compiled.json @@ -5,11 +5,22 @@ "4xx": "#F2C96D", "5xx": "#BF1B00" }, + "breakPoint": null, + "cacheTimeout": null, + "combine": { + "label": "Others", + "threshold": 0 + }, "datasource": "$PROMETHEUS", + "decimals": null, "description": "description", + "format": "short", "legend": { + "header": "", "percentage": true, "show": true, + "sort": "avg", + "sortDesc": true, "values": true }, "legendType": "Right side", @@ -19,34 +30,60 @@ "repeatDirection": "h", "span": 12, "targets": [ ], + "timeFrom": null, + "timeShift": null, "title": "test", "type": "grafana-piechart-panel", "valueName": "current" }, "basic": { "aliasColors": { }, + "breakPoint": null, + "cacheTimeout": null, + "combine": { + "label": "Others", + "threshold": 0 + }, "datasource": null, + "decimals": null, "description": "", + "format": "short", "legend": { + "header": "", "percentage": true, "show": true, + "sort": "avg", + "sortDesc": true, "values": true }, "legendType": "Right side", "pieType": "pie", "span": 12, "targets": [ ], + "timeFrom": null, + "timeShift": null, "title": "test", "type": "grafana-piechart-panel", "valueName": "current" }, "targets": { "aliasColors": { }, + "breakPoint": null, + "cacheTimeout": null, + "combine": { + "label": "Others", + "threshold": 0 + }, "datasource": null, + "decimals": null, "description": "", + "format": "short", "legend": { + "header": "", "percentage": true, "show": true, + "sort": "avg", + "sortDesc": true, "values": true }, "legendType": "Right side", @@ -62,6 +99,8 @@ "refId": "B" } ], + "timeFrom": null, + "timeShift": null, "title": "with targets", "type": "grafana-piechart-panel", "valueName": "current"