### Class BarChart

## SYNOPSIS

    import barchart

    class BarChart
      def __init__(self, datalist=None)
      string __module__ = 'barchart'
      def __str__(self)
      string GRAY2 = '#DDDDDD'
      def color_code(self, value)
      def gen_bar(self, value, color='blue')
      def gen_legend(self)
      def initialize(self)
      string WHITE = '#FFFFFF'
      def make_bar_cell(self, dict)
      int max_width = 400
      def normalize(self)
      def pixels(self, magnitude)
      string attr_template = ''
      string CADETBLUE = '#9999CC'
      int day_month_order = 0

## DESCRIPTION

Class which takes a DataList object and creates the HTML to represent a color coded bar chart.

Values to be charted are limited to non-negative values.

### def __init__(self, datalist=None)

datalist is an instance of class DataList

### def __str__(self)

Generate HTML for the entire table and caption.

### def color_code(self, value)

return a color string based on whether the given datum falls beyond thresholds. Works off self.thresholds=(low,hi).

### def gen_bar(self, value, color='blue')

return Image object for the scaled bar graphic

### def gen_legend(self)

Return an HTML string which displays the legend for the chart.

### def initialize(self)

Initialize the chart properties.

This method is overloaded by child classes.

### def make_bar_cell(self, dict)

return a TD object containing the scaled bar

### def normalize(self)

Scale data to values between 0 and 400.

Determine peak value and set scale accordingly. If the values are clustered within 30% of each other, will shift the zero point for the barchart up to exagerate the value differences. To inhibit this, set the .bound_zero attribute to "yes".

### def pixels(self, magnitude)

returns the integer number of pixels to represent a given magnitude.

## SEE ALSO

barchart

Copyright © Robin Friedrich
All Rights Reserved
Comments to author: dev@null
Generated: Tue Apr 20, 1999