def test_odf_create_chart_wall_style(self): s=odf_create_chart_wall_style("wall") expected=('<style:style style:family="chart" style:name="wall">' '<style:graphic-properties draw:stroke="solid" ' 'svg:stroke-color="#b3b3b3" draw:fill="none" ' 'draw:fill-color="#e6e6e6"/>' '</style:style>') self.assertEqual(s.serialize(), expected)
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) #we need an access to the office:chart element chart = chart_content.get_element("office:body/office:chart")
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)