On 20/11/2015 09:24, K 華 wrote:
> hi, I made my PDF with reportlab recent days, and draw a line plot in my reportnow I need to mark max/min point in my line plot, and my code is like below
> lp.lines[0].symbol = makeMarker('FilledCircle')lp.lines[0].strokeDashArray = [5, 1] lp.lines[(0,2)].symbol.fillColor = colors.green
>
> however it doesn't work at the point(0, 2) filled greendid I use the wrong way to achieve target? or is there another way to make this target working?thanks for your help
> KK2015/11/20
....
I did some hacks to the code and attach the versuion of lineplots.py that I
used; then the following code works as expected.
from reportlab.graphics.widgets.markers import makeMarker, Marker
from reportlab.graphics.widgetbase import Widget
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
from reportlab.graphics.charts.lineplots import LinePlot
from reportlab.lib.colors import green, blue
class Drawing_000(_DrawingEditorMixin,Drawing):
def __init__(self,width=400,height=200,*args,**kw):
Drawing.__init__(self,width,height,*args,**kw)
self._add(self,LinePlot(),name='chart',validate=None,desc=None)
self.chart.lines[0].symbol = makeMarker('FilledCircle')
self.chart.lines[(0, 1)].symbol= makeMarker('FilledSquare')
self.chart.lines[(0, 1)].symbol.size=10
self.chart.lines[(0, 1)].symbol.fillColor = green
self.chart.lines[(0, 1)].symbol.strokeColor = blue
self.chart.lines[(0, 1)].symbol.strokeWidth = 1
if __name__=="__main__": #NORUNTESTS
Drawing_000().save(formats=['pdf'],outDir='.',fnRoot=None)
please try this code and see if it works for you.
--
Robin Becker