<office:document-content
            xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
            xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
            xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
            xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
            xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
            xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
            xmlns:xlink="http://www.w3.org/1999/xlink"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
            xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
            xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
            xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
            xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
            xmlns:math="http://www.w3.org/1998/Math/MathML"
            xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
            xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
            xmlns:ooo="http://openoffice.org/2004/office"
            xmlns:ooow="http://openoffice.org/2004/writer"
            xmlns:oooc="http://openoffice.org/2004/calc"
            xmlns:dom="http://www.w3.org/2001/xml-events"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:tal="http://xml.zope.org/namespaces/tal"
            xmlns:metal="http://xml.zope.org/namespaces/metal"
            xmlns:i18n="http://xml.zope.org/namespaces/i18n" 
            office:version="1.0"
            >

  <tal:block tal:define="chart_form_id chart_form_id | request/chart_form_id;
             chart_field_id chart_field_id | request/chart_field_id;
              global form python: getattr(here, chart_form_id);
              global listbox python: getattr(form, chart_field_id);
              render_prefix render_prefix | request/render_prefix;
              global line_list python: listbox.get_value('default', context=here,
                                        render_format='list', REQUEST=request,
                                        render_prefix=render_prefix);
              global line_count python:len(line_list);
              user_column_id_list user_column_id_list | request/user_column_id_list;
              global column_list python:user_column_id_list or line_list[0].getColumnItemList();
              global column_count python:len(column_list);
              global chart_type chart_type | request/chart_type;
              global series_source series_source | request/series_source;
              global user_column_id_list user_column_id_list | request/user_column_id_list;
              global user_column_id_list_len python: len(user_column_id_list);
              colour_column_list colour_column_list | request/colour_column_list;
              global colour_column_dict python: dict(colour_column_list);
              global user_data_title user_data_title | request/user_data_title;
              global grid_graph grid_graph | request/grid_graph;
              global data_label_text data_label_text | request/data_label_text;
              global position_legend position_legend | request/position_legend;
              global chart_repeated python:series_source == 'columns'
              and line_count or column_count;
              global style_prefix string:ooo-chart-style-;
              global Utils python: modules['Products.ERP5Type.Utils']"/>

  <office:automatic-styles>
    <number:number-style style:name="N0">
      <number:number number:min-integer-digits="1"/>
    </number:number-style>

    <style:style style:name="chart_frame" style:family="chart">
      <style:graphic-properties draw:stroke="none"
                                  svg:stroke-width="0cm"
                                  svg:stroke-color="#000000"
                                  draw:fill-color="#FFFFFF"
                                  draw:opacity="100%"/>
    </style:style>
    <style:style style:name="chart_title" style:family="chart">
      <style:chart-properties style:direction="ltr"/>
      <style:graphic-properties draw:stroke="none" draw:fill="none"/>
      <style:text-properties fo:font-family="'DejaVu Sans'"
                             style:font-family-generic="swiss"
                             style:font-pitch="variable"
                             fo:font-size="35pt"
                             style:font-family-asian="'DejaVu Sans'"
                             style:font-family-generic-asian="system"
                             style:font-pitch-asian="variable"
                             style:font-size-asian="35pt"
                             style:font-family-complex="Tahoma"
                             style:font-family-generic-complex="system"
                             style:font-pitch-complex="variable"
                             style:font-size-complex="35pt"/>
    </style:style>

    <style:style style:name="chart_legend" style:family="chart">
      <style:graphic-properties draw:fill="none"/>
      <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/legend_text_style_properties" />
    </style:style>

    <style:style style:name="chart_picture" style:family="chart">
      <style:chart-properties chart:mean-value="false"
                    chart:error-margin="0"
                    chart:error-lower-limit="0"
                    chart:error-upper-limit="0"
                    chart:error-percentage="0"
                    chart:error-category="none"
                    chart:stock-with-volume="false"
                    chart:japanese-candle-stick="false"
                    tal:attributes="chart:three-dimensional chart_three_dimensional |  request/chart_three_dimensional | string:false;
                    chart:deep deep | request/deep;
                    chart:stacked chart_stacked | request/chart_stacked | string:false;
                    chart:vertical chart_position | request/chart_position | string:false;
                    chart:percentage chart_percentage | request/chart_percentage | string:false;
                    chart:symbol-type symbol_type | request/symbol_type;
                    chart:series-source series_source;
                    chart:connect-bars connect_bars | request/connect_bars;
                    chart:data-label-number data_label_number | request/data_label_number;
                    chart:data-label-symbol data_label_symbol | request/data_label_symbol | string:false;
                    chart:data-label-text data_label_text | string:false;
                    chart:lines-used lines_used | request/lines_used | string:0;
                    chart:regression-type regression_type | request/regression_type;
                    chart:interpolation interpolation | request/interpolation"/>
    </style:style>
    <tal:block tal:repeat="column_item column_list">
      <tal:block tal:define="column_id python:column_item[0];
                 index repeat/column_item/index">
        <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/line_style_properties" />
      </tal:block>
    </tal:block>
    <style:style style:name="chart_x_axis"
                 style:family="chart"
                 style:data-style-name="N0"
                 tal:define="property_dict python:{
                   'chart:display-label': 'true',
                   'chart:tick-marks-major-inner': 'true',
                   'chart:tick-marks-major-outer': 'true'};
                   x_axis_property_dict x_axis_property_dict | request/x_axis_property_dict;
                   dummy python: property_dict.update(x_axis_property_dict)">
      <tal:block replace="structure python: '&lt;style:chart-properties %s /&gt;'
                          % ' '.join('%s=%r' % (k, v)
                                     for k, v in property_dict.items()
                                     if v is not None)" />
      <style:graphic-properties draw:stroke="solid"
                                svg:stroke-width="0cm"
                                svg:stroke-color="#000000"/>
      <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/text_style_properties" />
    </style:style>
    <style:style style:name="chart_y_axis"
                 style:family="chart"
                 style:data-style-name="N0"
                 tal:define="property_dict python:{
                   'chart:display-label': 'true',
                   'chart:tick-marks-major-inner': 'true',
                   'chart:tick-marks-major-outer': 'true'};
                   y_axis_property_dict y_axis_property_dict | request/y_axis_property_dict;
                   dummy python: property_dict.update(y_axis_property_dict)">
      <tal:block replace="structure python: '&lt;style:chart-properties %s /&gt;'
                          % ' '.join('%s=%r' % (k, v)
                                     for k, v in property_dict.items()
                                     if v is not None)" />
      <style:graphic-properties draw:stroke="solid"
                                svg:stroke-width="0cm"
                                svg:stroke-color="#000000"/>
      <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/text_style_properties" />
    </style:style>
    <style:style style:family="chart" style:name="sector_pie">
      <style:chart-properties tal:attributes="chart:pie-offset sector_pie_offset | request/sector_pie_offset"/>
    </style:style>

    <style:style style:family="chart" style:name="other_style">
      <style:graphic-properties  svg:stroke-color='#000000'
                                 draw:stroke="solid"
                                 svg:stroke-width="0.01cm"/>
      <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/text_style_properties" />
    </style:style>

    <style:style style:name="chart_wall"
                 style:family="chart">
      <style:graphic-properties draw:stroke="none"
                                draw:fill="none"/>
      </style:style>
      <style:style style:name="chart_floor"
                   style:family="chart">
      <style:graphic-properties draw:stroke="none"
                                draw:fill-color="#999999"/>
    </style:style>
  </office:automatic-styles>

  <office:body>
    <office:chart>
      <chart:chart svg:width="30cm"
                   svg:height="30cm"
                   chart:style-name="chart_frame"
                   tal:attributes="chart:class chart_type">
        <tal:block tal:define="bool chart_title_or_no | request/chart_title_or_no"
                   tal:condition="python:bool=='true'">
          <chart:title chart:style-name="chart_title">
            <text:p tal:content="chart_title | request/chart_title" />
          </chart:title>
        </tal:block>
        <!-- Legend Of The Graph-->
        <chart:legend tal:condition="chart_legend | request/chart_legend | nothing"
                      tal:attributes="chart:legend-position position_legend"
                      chart:style-name="chart_legend" />
        <tal:block tal:define="column_item_list python:column_list[1:]">
          <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/generate-plot-area">
            <tal:block tal:condition="python:chart_type in ('chart:bar',
                                                            'chart:line',
                                                            'chart:scatter',
                                                            'chart:area')">
              <tal:block metal:fill-slot="chart-axis">
                <chart:axis chart:dimension="x"
                            chart:name="primary-x"
                            chart:style-name="chart_x_axis">
                  <chart:categories tal:attributes="table:cell-range-address string:local-table.$$A$$2:.$$A$$${chart_repeated}"/>
                </chart:axis>
                <chart:axis chart:dimension="y"
                            chart:name="primary-y"
                            chart:style-name="chart_y_axis">
                  <chart:grid tal:condition="python:grid_graph == 'true'"
                              tal:attributes="chart:class grid_size | request/grid_size | string:major"/>
                </chart:axis>
              </tal:block>
              <tal:block metal:fill-slot="chart-wall">
                <chart:wall chart:style-name="chart_wall"/>
              </tal:block>
              <tal:block metal:fill-slot="chart-floor">
                <chart:floor chart:style-name="chart_floor"/>
              </tal:block>
            </tal:block>
          </tal:block>
        </tal:block>
        <tal:block metal:use-macro="here/OOoChart_macroLibrary/macros/generate_spreadsheet"/>
      </chart:chart>
    </office:chart>
  </office:body>
</office:document-content>
