Der Chart -Titel befindet sich in Mitte/zwischen meinem Balkendiagramm, das mit OpenPyxl Barchart -Modul aufgezeichnet wPython

Python-Programme
Anonymous
 Der Chart -Titel befindet sich in Mitte/zwischen meinem Balkendiagramm, das mit OpenPyxl Barchart -Modul aufgezeichnet w

Post by Anonymous »

Ich verwende OpenPyxl (Python -Modul), um ein Balkendiagramm dynamisch mit Daten aus den jeweiligen Zellen zu zeichnen, aber der Diagramm -Titel wird zwischen meinem Balkendiagramm erhältlich.

Code: Select all

#sheet_velocity is the worksheet selected

# Chart object
chart_velocity = BarChart()

# Data and labels
chart_data = Reference(sheet_velocity, min_col=3, min_row=3, max_row=14)
categories = Reference(sheet_velocity, min_col=1, min_row=3, max_row=14)

chart_velocity.title = "Custom Title"
chart_velocity.title.text.rich.paragraphs[0].pPr = ParagraphProperties(defRPr=CharacterProperties(sz=1250))
man_layout = ManualLayout(xMode="edge", yMode="edge", x=0.0, y = -0.05) #tried -ve value
chart_velocity.title.layout = Layout(manualLayout=man_layout)
chart_velocity.add_data(chart_data, titles_from_data=False)
chart_velocity.set_categories(categories)
chart_velocity.dataLabels = DataLabelList()
chart_velocity.dataLabels.showVal = True  # Show the value of the data point
chart_velocity.dataLabels.showSerName = False
chart_velocity.dataLabels.showCatName = False
chart_velocity.dataLabels.showLegendKey = False
chart_velocity.legend = None
chart_velocity.x_axis.delete = False
chart_velocity.y_axis.delete = False
series = chart_velocity.series[0]
series.graphicalProperties.solidFill = "379e3e"
sheet_velocity.add_chart(chart_velocity, "F3")

Dinge, die ich bisher ausprobiert habe (haben nicht funktioniert):
  • Die Charts. />
  • Changing the position of chart title using ManualLayout
    For example: manual_layout = ManualLayout(xMode="edge", yMode="edge", x=0.0, y=0.0)
(Giving a +ve Wert für y würde den Titel abbauen, aber ihn nicht nach oben bewegen, versuchten -ve -Wert -> hat nicht funktioniert.)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post