Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Commit

Permalink
Merge branch 'master' of git@github.com:chrisdrackett/django-googlech…
Browse files Browse the repository at this point in the history
…arts

Conflicts:

	templatetags/charts.py
  • Loading branch information
Chris Drackett committed Jan 16, 2009
2 parents db688e6 + 8aa11ae commit 802b864
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions templatetags/charts.py
Expand Up @@ -72,10 +72,10 @@ def render(self, context):
if o.startswith('_'):
context[o[1:]] = c.options[o]

# # Create some additional images showing only one of the colors,
# # replacing the others with grayed-out images
# for o in c.options['_final_color_map'].items():
# context["chart_%s_only" % o[1]] = c.img(color_override=o[0])
# Create some additional images showing only one of the colors,
# replacing the others with grayed-out images
for o in c.options['_final_color_map'].items():
context["chart_%s_only" % o[1]] = c.img(color_override=o[0])

if self.varname:
context[self.varname] = c
Expand Down Expand Up @@ -114,7 +114,9 @@ def img(self, color_override = None):
if color_override is not None:
final_color = []
for c in self.options['chco'].split(','):
if c != color_override:
if c == color_override:
c = orig_colors.split(',')[0]
else:
c = chart_inactive_color
final_color.append(c)
self.options['chco'] = ','.join(final_color)
Expand Down Expand Up @@ -148,7 +150,7 @@ def url(self):
if k not in self.options:
self.options[k] = self.defaults[k]

# Start to calcuate the URL
# Start to calculate the URL
url = "%s?%s&chd=%s" % (self.BASE, urlencode(self.options), encoded_data)

# Calculate axis options
Expand Down Expand Up @@ -334,10 +336,6 @@ def chart_auto_colors(color, item_label_list):

# Switch to HSV color space
hsv = colorsys.rgb_to_hsv(_r, _g, _b)
hls = colorsys.rgb_to_hls(_r, _g, _b)

print hsv
print hls

colors = []

Expand All @@ -346,7 +344,6 @@ def chart_auto_colors(color, item_label_list):

# For each label, compute a new color
for index, color in enumerate(range(0, len(item_label_list))):

if index == 0:
# this is the first value, make it 100%
value = hsv[1]
Expand Down Expand Up @@ -376,7 +373,7 @@ def chart_auto_colors(color, item_label_list):
c_final.append(c)
colors.append(''.join(c_final))

final_color_map = {}
final_color_map = SortedDict()

# Map our final color values to the label that will be associated with them
for index, c in enumerate(colors):
Expand Down Expand Up @@ -678,4 +675,4 @@ def flatten(iterator):
for j in flatten(iter(i)):
yield j
else:
yield i
yield i

0 comments on commit 802b864

Please sign in to comment.