From 9636dec0ba8c791034e52a54fbb8189cfe8ac92c Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Wed, 28 Oct 2009 10:49:51 +0000 Subject: [PATCH] Add properties on OOoChart fields to customize X/Y Axis git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30059 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../erp5_core/ERP5Site_buildChart.xml | 45 +++++++++---------- product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- product/ERP5Form/OOoChart.py | 35 ++++++++++++--- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml index d127dfa16c..ec583cb38d 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ERP5Site_buildChart.xml @@ -168,16 +168,17 @@ </tal:block>\n <style:style style:name="chart_x_axis"\n style:family="chart"\n - style:data-style-name="N0">\n - <style:chart-properties chart:display-label="true"\n - chart:tick-marks-major-inner="true"\n - chart:tick-marks-major-outer="true"\n - chart:logarithmic="false"\n - chart:text-overlap="true"\n - text:line-break="true"\n - chart:label-arrangement="side-by-side"\n - chart:visible="true"\n - style:direction="ltr"/>\n + style:data-style-name="N0"\n + tal:define="property_dict python:{\n + \'chart:display-label\': \'true\',\n + \'chart:tick-marks-major-inner\': \'true\',\n + \'chart:tick-marks-major-outer\': \'true\'};\n + x_axis_property_dict x_axis_property_dict | request/x_axis_property_dict;\n + dummy python: property_dict.update(x_axis_property_dict)">\n + <tal:block replace="structure python: \'<style:chart-properties %s />\'\n + % \' \'.join(\'%s=%r\' % (k, v)\n + for k, v in property_dict.items()\n + if v is not None)" />\n <style:graphic-properties draw:stroke="solid"\n svg:stroke-width="0cm"\n svg:stroke-color="#000000"/>\n @@ -185,19 +186,17 @@ </style:style>\n <style:style style:name="chart_y_axis"\n style:family="chart"\n - style:data-style-name="N0">\n - <style:chart-properties chart:display-label="true"\n - chart:tick-marks-major-inner="true"\n - chart:tick-marks-major-outer="true"\n - chart:logarithmic="false"\n - chart:origin="0"\n - chart:gap-width="100"\n - chart:overlap="0"\n - chart:text-overlap="false"\n - text:line-break="false"\n - chart:label-arrangement="side-by-side"\n - chart:visible="true"\n - style:direction="ltr"/>\n + style:data-style-name="N0"\n + tal:define="property_dict python:{\n + \'chart:display-label\': \'true\',\n + \'chart:tick-marks-major-inner\': \'true\',\n + \'chart:tick-marks-major-outer\': \'true\'};\n + y_axis_property_dict y_axis_property_dict | request/y_axis_property_dict;\n + dummy python: property_dict.update(y_axis_property_dict)">\n + <tal:block replace="structure python: \'<style:chart-properties %s />\'\n + % \' \'.join(\'%s=%r\' % (k, v)\n + for k, v in property_dict.items()\n + if v is not None)" />\n <style:graphic-properties draw:stroke="solid"\n svg:stroke-width="0cm"\n svg:stroke-color="#000000"/>\n diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 90dfef9516..a41bc3f36a 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -1349 \ No newline at end of file +1350 \ No newline at end of file diff --git a/product/ERP5Form/OOoChart.py b/product/ERP5Form/OOoChart.py index ff23ef9aca..b895fd8f2d 100644 --- a/product/ERP5Form/OOoChart.py +++ b/product/ERP5Form/OOoChart.py @@ -55,12 +55,8 @@ class OOoChartWidget(Widget.Widget): property_names = list(Widget.Widget.property_names) - default = fields.StringField( - 'default', - title='Default', - description=("A default value (not used)."), - default="", - required=0) + # Default has no meaning in OOoChart. + property_names.remove('default') listbox_form_id = fields.StringField( 'listbox_form_id', @@ -173,6 +169,30 @@ class OOoChartWidget(Widget.Widget): required=0) property_names.append('chart_title_or_no') + # Axis + x_axis_property_list = fields.ListTextAreaField('x_axis_property_list', + title="X-Axis Properties", + description="Examples of recognized properties:" + " 'chart:visible'," + " 'chart:display-label'," + " 'chart:label-arrangement'," + " 'chart:tick-marks-major-inner'," + " 'chart:reverse-direction'," + " 'chart:logarithmic'," + " 'chart:text-overlap'," + " 'chart:origin'," + " 'text:line-break'," + " 'style:rotation-angle'...", + default=(), + required=0) + property_names.append('x_axis_property_list') + + y_axis_property_list = fields.ListTextAreaField('y_axis_property_list', + title="Y-Axis Properties", + default=(), + required=0) + property_names.append('y_axis_property_list') + #grid or not grid_graph = fields.CheckBoxField('grid_graph', title='Chart Grid ', @@ -248,7 +268,6 @@ class OOoChartWidget(Widget.Widget): default=0, required=0) property_names.append('sector_pie_offset') - #interpolation="none", cubic-spline, b-spline @@ -358,6 +377,8 @@ class OOoChartWidget(Widget.Widget): chart_position = field.get_value('chart_position'), chart_legend = stringBoolean(field.get_value('chart_legend')), chart_title_or_no = stringBoolean(field.get_value('chart_title_or_no')), + x_axis_property_dict = dict(field.get_value('x_axis_property_list')), + y_axis_property_dict = dict(field.get_value('y_axis_property_list')), grid_graph = stringBoolean(field.get_value('grid_graph')), grid_size=field.get_value('grid_size'), chart_three_dimensional = stringBoolean(field.get_value('chart_three_dimensional')), -- 2.30.9