def test_scatter_opts_after(): c = gen_scatter_base() c.opts = remove_key_with_none_value(c.opts) expected = { "title": "Scatter", "data": { "datasets": [{ "label": "series-A", "data": [{ "x": "1", "y": 1 }, { "x": "2", "y": 2 }] }] }, "xLabel": "I'm xlabel", "yLabel": "I'm ylabel", "options": { "xTickCount": 3, "yTickCount": 3, "legendPosition": 1, "showLine": False, "dotSize": 1, }, } assert_equal(c.opts, expected)
def test_bar_opts_after(): c = gen_bar_base() c.opts = remove_key_with_none_value(c.opts) expected = { "title": "Bar", "data": { "datasets": [{"label": "series-A", "data": ["1", "2"]}], "labels": ["A", "B"], }, "xLabel": "I'm xlabel", "yLabel": "I'm ylabel", "options": {"yTickCount": 3}, } assert_equal(c.opts, expected)
def test_pie_opts_after(): c = gen_pie_base() c.opts = remove_key_with_none_value(c.opts) expected = { "title": "Pie", "data": { "datasets": [{ "data": ["1", "2"] }], "labels": ["A", "B"] }, "options": { "innerRadius": 0.5, "legendPosition": 1 }, } assert_equal(c.opts, expected)
def test_radar_opts_after(): c = gen_radar_base() c.opts = remove_key_with_none_value(c.opts) expected = { "title": "Radar", "data": { "datasets": [{ "label": "series-A", "data": ["1", "2"] }], "labels": ["A", "B"], }, "options": { "showLegend": True, "showLabel": True, "tickCount": 3, "legendPosition": 1, }, } assert_equal(c.opts, expected)
def before_render(self): for chart in self._charts: chart.chart_id = uuid.uuid4().hex chart.opts = remove_key_with_none_value(chart.opts) chart.json_content = json.dumps(chart.opts) self.local_cfg, self.notebook_cfg = self._produce_assets_cfg()
def before_render(self): self.opts = remove_key_with_none_value(self.opts) json_content = json.dumps(self.opts) self.opts = json_content self.local_cfg, self.notebook_cfg = self._produce_assets_cfg()