Esempio n. 1
0
 def test_odf_create_chart_plot_area_style(self):
     s=odf_create_chart_plot_area_style("plot")
     expected=('<style:style style:family="chart" style:name="plot">'
                 '<style:chart-properties '
                   'chart:include-hidden-cells="false" '
                   'chart:auto-size="true" chart:auto-position="true" '
                   'chart:treat-empty-cells="leave-gap" '
                   'chart:right-angled-axes="true"/>'
               '</style:style>')
     self.assertEqual(s.serialize(), expected)
Esempio n. 2
0
#we need an access to the office:automatic-styles element
from lpod.xmlpart import odf_xmlpart
chart_content = odf_xmlpart(chart_directory+'/content.xml', doc)
styles =  chart_content.get_element("office:automatic-styles")

#we add informations about style
from chart_style import odf_create_chart_title_style
from chart_style import odf_create_chart_legend_style
from chart_style import odf_create_chart_plot_area_style
from chart_style import odf_create_chart_axis_style
from chart_style import odf_create_chart_axis_title_style
from chart_style import odf_create_chart_wall_style, odf_create_chart_style

styles.append(odf_create_chart_title_style("titre", "12pt"))
plot_s=odf_create_chart_plot_area_style("plot")
styles.append(plot_s)
styles.append(odf_create_chart_axis_style("axe x"))
styles.append(odf_create_chart_axis_style("axe y"))
styles.append(odf_create_chart_wall_style("wall"))

#we choose a color for each series
palette=['#0000ff', '#bf00ff', '#ff0080', '#ff4000', '#ffff00', '#40ff00',
'#00ff7f', '#00bfff', '#6000ff', '#ff00df', '#ff0020', '#ff9f00', '#9fff00',
'#00ff20', '#00ffdf', '#0060ff']

from chart import divide_range
cols_list = divide_range("Data.A1:Data.E5")
for i in range(len(cols_list)):
    s = odf_create_chart_style("series"+str(i))
    s.set_fill("solid", palette[i])
Esempio n. 3
0
#we need an access to the office:automatic-styles element
from lpod.xmlpart import odf_xmlpart
chart_content = odf_xmlpart(chart_directory + '/content.xml', doc)
styles = chart_content.get_element("office:automatic-styles")

#we add informations about style
from chart_style import odf_create_chart_title_style
from chart_style import odf_create_chart_legend_style
from chart_style import odf_create_chart_plot_area_style
from chart_style import odf_create_chart_axis_style
from chart_style import odf_create_chart_axis_title_style
from chart_style import odf_create_chart_wall_style, odf_create_chart_style

styles.append(odf_create_chart_title_style("titre", "12pt"))
plot_s = odf_create_chart_plot_area_style("plot")
styles.append(plot_s)
styles.append(odf_create_chart_axis_style("axe x"))
styles.append(odf_create_chart_axis_style("axe y"))
styles.append(odf_create_chart_wall_style("wall"))

#we choose a color for each series
palette = [
    '#0000ff', '#bf00ff', '#ff0080', '#ff4000', '#ffff00', '#40ff00',
    '#00ff7f', '#00bfff', '#6000ff', '#ff00df', '#ff0020', '#ff9f00',
    '#9fff00', '#00ff20', '#00ffdf', '#0060ff'
]

from chart import divide_range
cols_list = divide_range("Data.A1:Data.E5")
for i in range(len(cols_list)):