[reportlab-users] How to mark a specific point in line plot?

K 華 k940545 at hotmail.com
Mon Nov 23 03:22:12 EST 2015


It works well, thanks a lot!!

Now I have another question, I know that "lineLabelFormat" display all values on lineplot, and "lineLabels[(0, 2)]"  can set one of values' attribute.but how to display specific value or fonts on the marked point?
thanks
KK2015/11/23

To: reportlab-users at lists2.reportlab.com
From: robin at reportlab.com
Date: Fri, 20 Nov 2015 11:48:28 +0000
Subject: Re: [reportlab-users] How to mark a specific point in line plot?

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

_______________________________________________
reportlab-users mailing list
reportlab-users at lists2.reportlab.com
https://pairlist2.pair.net/mailman/listinfo/reportlab-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20151123/73cfad72/attachment.html>


More information about the reportlab-users mailing list