Commit 9636dec0 authored by Julien Muchembled's avatar Julien Muchembled

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
parent 3775c847
...@@ -168,16 +168,17 @@ ...@@ -168,16 +168,17 @@
</tal:block>\n </tal:block>\n
<style:style style:name="chart_x_axis"\n <style:style style:name="chart_x_axis"\n
style:family="chart"\n style:family="chart"\n
style:data-style-name="N0">\n style:data-style-name="N0"\n
<style:chart-properties chart:display-label="true"\n tal:define="property_dict python:{\n
chart:tick-marks-major-inner="true"\n \'chart:display-label\': \'true\',\n
chart:tick-marks-major-outer="true"\n \'chart:tick-marks-major-inner\': \'true\',\n
chart:logarithmic="false"\n \'chart:tick-marks-major-outer\': \'true\'};\n
chart:text-overlap="true"\n x_axis_property_dict x_axis_property_dict | request/x_axis_property_dict;\n
text:line-break="true"\n dummy python: property_dict.update(x_axis_property_dict)">\n
chart:label-arrangement="side-by-side"\n <tal:block replace="structure python: \'&lt;style:chart-properties %s /&gt;\'\n
chart:visible="true"\n % \' \'.join(\'%s=%r\' % (k, v)\n
style:direction="ltr"/>\n for k, v in property_dict.items()\n
if v is not None)" />\n
<style:graphic-properties draw:stroke="solid"\n <style:graphic-properties draw:stroke="solid"\n
svg:stroke-width="0cm"\n svg:stroke-width="0cm"\n
svg:stroke-color="#000000"/>\n svg:stroke-color="#000000"/>\n
...@@ -185,19 +186,17 @@ ...@@ -185,19 +186,17 @@
</style:style>\n </style:style>\n
<style:style style:name="chart_y_axis"\n <style:style style:name="chart_y_axis"\n
style:family="chart"\n style:family="chart"\n
style:data-style-name="N0">\n style:data-style-name="N0"\n
<style:chart-properties chart:display-label="true"\n tal:define="property_dict python:{\n
chart:tick-marks-major-inner="true"\n \'chart:display-label\': \'true\',\n
chart:tick-marks-major-outer="true"\n \'chart:tick-marks-major-inner\': \'true\',\n
chart:logarithmic="false"\n \'chart:tick-marks-major-outer\': \'true\'};\n
chart:origin="0"\n y_axis_property_dict y_axis_property_dict | request/y_axis_property_dict;\n
chart:gap-width="100"\n dummy python: property_dict.update(y_axis_property_dict)">\n
chart:overlap="0"\n <tal:block replace="structure python: \'&lt;style:chart-properties %s /&gt;\'\n
chart:text-overlap="false"\n % \' \'.join(\'%s=%r\' % (k, v)\n
text:line-break="false"\n for k, v in property_dict.items()\n
chart:label-arrangement="side-by-side"\n if v is not None)" />\n
chart:visible="true"\n
style:direction="ltr"/>\n
<style:graphic-properties draw:stroke="solid"\n <style:graphic-properties draw:stroke="solid"\n
svg:stroke-width="0cm"\n svg:stroke-width="0cm"\n
svg:stroke-color="#000000"/>\n svg:stroke-color="#000000"/>\n
......
1349 1350
\ No newline at end of file \ No newline at end of file
...@@ -55,12 +55,8 @@ class OOoChartWidget(Widget.Widget): ...@@ -55,12 +55,8 @@ class OOoChartWidget(Widget.Widget):
property_names = list(Widget.Widget.property_names) property_names = list(Widget.Widget.property_names)
default = fields.StringField( # Default has no meaning in OOoChart.
'default', property_names.remove('default')
title='Default',
description=("A default value (not used)."),
default="",
required=0)
listbox_form_id = fields.StringField( listbox_form_id = fields.StringField(
'listbox_form_id', 'listbox_form_id',
...@@ -173,6 +169,30 @@ class OOoChartWidget(Widget.Widget): ...@@ -173,6 +169,30 @@ class OOoChartWidget(Widget.Widget):
required=0) required=0)
property_names.append('chart_title_or_no') 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 or not
grid_graph = fields.CheckBoxField('grid_graph', grid_graph = fields.CheckBoxField('grid_graph',
title='Chart Grid ', title='Chart Grid ',
...@@ -250,7 +270,6 @@ class OOoChartWidget(Widget.Widget): ...@@ -250,7 +270,6 @@ class OOoChartWidget(Widget.Widget):
property_names.append('sector_pie_offset') property_names.append('sector_pie_offset')
#interpolation="none", cubic-spline, b-spline #interpolation="none", cubic-spline, b-spline
interpolation = fields.ListField('interpolation', interpolation = fields.ListField('interpolation',
title='Interpolation', title='Interpolation',
...@@ -358,6 +377,8 @@ class OOoChartWidget(Widget.Widget): ...@@ -358,6 +377,8 @@ class OOoChartWidget(Widget.Widget):
chart_position = field.get_value('chart_position'), chart_position = field.get_value('chart_position'),
chart_legend = stringBoolean(field.get_value('chart_legend')), chart_legend = stringBoolean(field.get_value('chart_legend')),
chart_title_or_no = stringBoolean(field.get_value('chart_title_or_no')), 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_graph = stringBoolean(field.get_value('grid_graph')),
grid_size=field.get_value('grid_size'), grid_size=field.get_value('grid_size'),
chart_three_dimensional = stringBoolean(field.get_value('chart_three_dimensional')), chart_three_dimensional = stringBoolean(field.get_value('chart_three_dimensional')),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment