Re: How to mark a specific point in line plot?

K 華 <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <[email protected]>
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: [email protected]
From: [email protected]
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
[email protected]
https://pairlist2.pair.net/mailman/listinfo/reportlab-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.