Logo Search packages:      
Sourcecode: python-biopython version File versions

def Bio::Graphics::Distribution::BarChartDistribution::draw (   self,
  cur_drawing,
  start_x,
  start_y,
  end_x,
  end_y 
)

Draw a bar chart with the info in the specified range.

Definition at line 161 of file Distribution.py.

00161                                                                :
        """Draw a bar chart with the info in the specified range.
        """
        bar_chart = VerticalBarChart()
        if self.chart_title:
            self._draw_title(cur_drawing, self.chart_title,
                             start_x, start_y, end_x, end_y)
        # set the position of the bar chart
        x_start, x_end, y_start, y_end = \
           self._determine_position(start_x, start_y, end_x, end_y)
                                          
        bar_chart.x = x_start
        bar_chart.y = y_start
        bar_chart.width = abs(x_start - x_end)
        bar_chart.height = abs(y_start - y_end)

        # set the information in the bar chart
        bar_chart.data = self.display_info
        bar_chart.valueAxis.valueMin = min(self.display_info[0])
        bar_chart.valueAxis.valueMax = max(self.display_info[0])
        for data_set in self.display_info[1:]:
            if min(data_set) < bar_chart.valueAxis.valueMin:
                bar_chart.valueAxis.valueMin = min(data_set)
            if max(data_set) > bar_chart.valueAxis.valueMax:
                bar_chart.valueAxis.valueMax = max(data_set)

        # set other formatting options
        if len(self.display_info) == 1:
            bar_chart.groupSpacing = 0
            style = TypedPropertyCollection(BarChartProperties)
            style.strokeWidth = 0
            style.strokeColor = colors.green
            style[0].fillColor = colors.green

            bar_chart.bars = style
        

        # set the labels
        # XXX labels don't work yet
        # bar_chart.valueAxis.title = self.x_axis_title
        # bar_chart.categoryAxis.title = self.y_axis_title

        cur_drawing.add(bar_chart)

    def _draw_title(self, cur_drawing, title, start_x, start_y, end_x, end_y):


Generated by  Doxygen 1.6.0   Back to index