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

Commit

Permalink
Added new axis option for setting the tick length
Browse files Browse the repository at this point in the history
  • Loading branch information
tupperware14 committed Aug 28, 2009
1 parent bd58fc1 commit f163d08
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions googlecharts/templatetags/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ def resolve(self, context):
if isinstance(data, basestring):
data = filter(None, map(safefloat, data.split(",")))
else:
data = filter(None, map(safefloat, data))

# I don't understand why you would remove zero values, as this does?
# I'm going to comment it out and use my own version
# data = filter(None, map(safefloat, data))
data = map(safefloat, data)

resolved.append(data)

return resolved
Expand Down Expand Up @@ -279,6 +282,7 @@ def chart_type(arg):
"""
types = {
'line': 'lc',
'sparkline': 'ls',
'xy': 'lxy',
'line-xy': 'lxy',
'bar': 'bhg',
Expand Down Expand Up @@ -412,7 +416,11 @@ def chart_fill_area(color, startindex=0, endindex=0):
def chart_marker(marker, color, dataset_index, data_point, size):
marker = marker_types.get(marker, marker)
return {"chm": smart_join(",", marker, color, dataset_index, data_point, size)}


@option("line-bar-combo", multi="|")
def line_bar_combo(dataset_index, color, size):
return {"chm": smart_join(",", 'D', color, dataset_index, 0, size, 1)}

@option("chart-markers", multi="|")
def chart_markers(dataset_index, iterable):
"""Provide an iterable yielding (type, color, point, size)"""
Expand Down Expand Up @@ -573,7 +581,12 @@ def axis_range(start, end):
def axis_style(color, font_size=None, alignment=None):
alignment = alignments.get(alignment, alignment)
return {"chxs": smart_join(",", "%s", color, font_size, alignment)}


@option("axis-tick-length", nodeclass=AxisOptionNode)
def axis_range(length):
return {"chxtc": "%%s,%s" % (length)}


#
# "Metadata" nodes
#
Expand Down

0 comments on commit f163d08

Please sign in to comment.