Example #1
0
 def test_odf_create_chart_axis_style(self):
     s=odf_create_chart_axis_style("axis")
     expected=('<style:style style:family="chart" style:name="axis">'
                 '<style:chart-properties chart:display-label="true" '
                   'chart:logarithmic="false" '
                   'chart:reverse-direction="false" text:line-break="true" '
                   'chart:axis-position="0"/>'
                 '<style:graphic-properties draw:stroke="none" '
                   'svg:stroke-color="#b3b3b3"/>'
                 '<style:text-properties fo:font-size="8pt" '
                   'style:font-size-asian="8pt" '
                   'style:font-size-complex="8pt"/>'
               '</style:style>')
     self.assertEqual(s.serialize(), expected)
Example #2
0
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])
    styles.append(s)
Example #3
0
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])