Browse Source

Added the ability to disable drawing lines between points (for a scatter-like chart).

Also, constant lines are now drawn over the data.  I'm not sure this is appropriate either, but in the case of the NucTrans data, this definitely works better.  Perhaps this concept needs to be abstracted a bit more, but for now, this will do.
pull/8/head
JARACO\jaraco 19 years ago
parent
commit
307a6ddd25
  1. 5
      Plot.py

5
Plot.py

@ -115,6 +115,8 @@ class Plot( SVG.Graph ):
"""Show a small circle on the graph where the line """Show a small circle on the graph where the line
goes from one point to the next.""" goes from one point to the next."""
show_data_points = True show_data_points = True
"Indicate whether the lines should be drawn between points"
draw_lines_between_points = True
"Set the minimum value of the X axis" "Set the minimum value of the X axis"
min_x_value = None min_x_value = None
"Set the minimum value of the Y axis" "Set the minimum value of the Y axis"
@ -228,7 +230,6 @@ class Plot( SVG.Graph ):
def draw_data( self ): def draw_data( self ):
self.load_transform_parameters() self.load_transform_parameters()
self._draw_constant_lines( )
for line, data in izip( count(1), self.data ): for line, data in izip( count(1), self.data ):
x_start, y_start = self.transform_output_coordinates( x_start, y_start = self.transform_output_coordinates(
( data['data'][self.x_data_index][0], ( data['data'][self.x_data_index][0],
@ -243,11 +244,13 @@ class Plot( SVG.Graph ):
'd': 'M%(x_start)f %(graph_height)f %(lpath)s V%(graph_height)f Z' % vars(), 'd': 'M%(x_start)f %(graph_height)f %(lpath)s V%(graph_height)f Z' % vars(),
'class': 'fill%(line)d' % vars() } ) 'class': 'fill%(line)d' % vars() } )
self.graph.appendChild( path ) self.graph.appendChild( path )
if self.draw_lines_between_points:
path = self._create_element( 'path', { path = self._create_element( 'path', {
'd': 'M%(x_start)f %(y_start)f %(lpath)s' % vars(), 'd': 'M%(x_start)f %(y_start)f %(lpath)s' % vars(),
'class': 'line%(line)d' % vars() } ) 'class': 'line%(line)d' % vars() } )
self.graph.appendChild( path ) self.graph.appendChild( path )
self.draw_data_points( line, data_points, graph_points ) self.draw_data_points( line, data_points, graph_points )
self._draw_constant_lines( )
del self.__transform_parameters del self.__transform_parameters
def add_constant_line( self, value, label = None, style = None ): def add_constant_line( self, value, label = None, style = None ):

Loading…
Cancel
Save