3
我正在使用reportlab生成一個LinePlot圖表。我似乎無法獲得X軸的非數字標籤。 將日期標籤添加到reportlab LinePlot圖表
有沒有人有任何想法?
這是我Lineplot圖表類(注:IM donig這個類以外的一些計算和設置,但你得到的要點
import reportlab
from advisor.charting.Font import Font
from reportlab.lib.colors import Color, HexColor
from reportlab.lib.pagesizes import cm, inch
from reportlab.graphics.charts.legends import Legend
from reportlab.graphics.charts.textlabels import Label
from reportlab.graphics.charts.linecharts import HorizontalLineChart
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.graphics.shapes import Drawing, String, _DrawingEditorMixin
from reportlab.graphics.widgets.markers import makeMarker
class TacticalAugLineGraph(_DrawingEditorMixin, Drawing):
def __init__(self, width=100, height=110, legend=False, *args, **kw):
apply(Drawing.__init__, (self, width, height) + args, kw)
chartFont = Font('Gotham-Bold')
self._add(self, LinePlot(), name='chart', validate=None, desc=None)
self.chart._inFill = 1
self.chart.x = 20
self.chart.y = 15
self.chart.width = 85
self.chart.height = 95
#self.chart.lineLabelFormat = '%d%%'
self.chart.yValueAxis.valueMin = 0
self.chart.yValueAxis.valueMax = 100
self.chart.yValueAxis.valueStep = 10
def apply_colors(self, colors):
self.chart.lines[0].strokeColor = colors[0]
self.chart.lines[1].strokeColor = colors[1]
self.chart.lines[2].strokeColor = colors[2]
self.chart.lines[3].strokeColor = colors[3]