diff --git a/demo_proj/demo_app/reports.py b/demo_proj/demo_app/reports.py index dc578d7..6590c0a 100644 --- a/demo_proj/demo_app/reports.py +++ b/demo_proj/demo_app/reports.py @@ -601,28 +601,44 @@ class ChartJSExample(TimeSeriesReport): title_source=["name"], plot_total=True, ), - Chart( - "Total Sales [Line details]", - Chart.LINE, - data_source=["sum__value"], - title_source=["name"], - # plot_total=True, - ), + # Chart( + # "Total Sales [Line details]", + # Chart.LINE, + # data_source=["sum__value"], + # title_source=["name"], + # # plot_total=True, + # ), ] -class HighChartExample(ChartJSExample): +class HighChartExample(TimeSeriesReport): chart_engine = "highcharts" + report_title = _("Highcharts Examples ") chart_settings = [ - Chart("Client Sales Column", Chart.COLUMN, data_source=["sum__value"], title_source=["name"]), + Chart("Client Sales [Column]", Chart.COLUMN, data_source=["sum__value"], title_source=["name"]), + Chart( + "Stacking Client Sales [Column]", + Chart.COLUMN, + data_source=["sum__value"], + title_source=["name"], + stacking=True, + ), Chart( - "Total Client Sales Column", + "Total Client Sales[Column]", Chart.COLUMN, data_source=["sum__value"], title_source=["name"], plot_total=True, ), + Chart( + "Stacking Total Client Sales [Column]", + Chart.COLUMN, + data_source=["sum__value"], + title_source=["name"], + plot_total=True, + stacking=True, + ), Chart( "Client Sales [Bar]", Chart.BAR, @@ -653,6 +669,12 @@ class HighChartExample(ChartJSExample): title_source=["name"], plot_total=True, ), + Chart( + "Client Sales [Area]", + Chart.AREA, + data_source=["sum__value"], + title_source=["name"], + ), ] diff --git a/demo_proj/templates/menu.html b/demo_proj/templates/menu.html index f961660..8174ae3 100644 --- a/demo_proj/templates/menu.html +++ b/demo_proj/templates/menu.html @@ -173,7 +173,7 @@ d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"/> - HighCharts + HighCharts Charts Demo @@ -188,7 +188,7 @@ d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"/> - ChartsJS + Charts.js Charts @@ -202,7 +202,7 @@ d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6"/> - Apex Chart Demo + Apex Charts diff --git a/slick_reporting/generator.py b/slick_reporting/generator.py index 4231eed..2a02c41 100644 --- a/slick_reporting/generator.py +++ b/slick_reporting/generator.py @@ -22,6 +22,7 @@ class Chart: data_source: list title_source: list plot_total: bool = False + stacking: bool = False # only for highcharts engine: str = "" entryPoint: str = "" COLUMN = "column" @@ -39,6 +40,7 @@ def to_dict(self): plot_total=self.plot_total, engine=self.engine, entryPoint=self.entryPoint, + stacking=self.stacking, ) @@ -938,7 +940,7 @@ def get_full_response( @staticmethod def get_chart_settings(chart_settings=None, default_chart_title=None, chart_engine=None): """ - Ensure the sane settings are passed to the front end. + Ensure the sane settings are passed to the front end. ? """ chart_engine = chart_engine or SLICK_REPORTING_DEFAULT_CHARTS_ENGINE output = [] @@ -959,6 +961,7 @@ def get_chart_settings(chart_settings=None, default_chart_title=None, chart_engi chart.get("entryPoint") or app_settings.SLICK_REPORTING_SETTINGS["CHARTS"][chart["engine_name"]]["entryPoint"] ) + chart["stacking"] = chart.get("stacking", False) output.append(chart) return output diff --git a/slick_reporting/static/slick_reporting/slick_reporting.highchart.js b/slick_reporting/static/slick_reporting/slick_reporting.highchart.js index 8df9b06..a6dc23e 100644 --- a/slick_reporting/static/slick_reporting/slick_reporting.highchart.js +++ b/slick_reporting/static/slick_reporting/slick_reporting.highchart.js @@ -60,7 +60,6 @@ }); chartOptions.data = response.data; - let is_time_series = is_timeseries_support(response, chartOptions); // response.metadata.time_series_pattern || ''; let is_crosstab = is_crosstab_support(response, chartOptions);