Skip to content

Commit

Permalink
Viz type clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Oct 1, 2015
1 parent 601e30a commit 04f914f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion panoramix/bin/panoramix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def load_examples(sample):
sum_boys=num if gender == 'boy' else 0,
sum_girls=num if gender == 'girl' else 0,
)
if i % 5000 == 0:
if i % 1000 == 0:
print("{} loaded out of 82527 rows".format(i))
session.commit()
session.commit()
Expand Down
48 changes: 28 additions & 20 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


class BaseViz(object):
viz_type = None
verbose_name = "Base Viz"
template = None
form_fields = [
Expand Down Expand Up @@ -174,6 +175,7 @@ def get_json_data(self):
return json.dumps([])

class TableViz(BaseViz):
viz_type = "table"
verbose_name = "Table View"
template = 'panoramix/viz_table.html'
form_fields = BaseViz.form_fields + ['row_limit']
Expand All @@ -198,6 +200,7 @@ def get_df(self):


class MarkupViz(BaseViz):
viz_type = "markup"
verbose_name = "Markup Widget"
template = 'panoramix/viz_markup.html'
form_fields = ['viz_type', 'markup_type', 'code']
Expand All @@ -216,6 +219,7 @@ class WordCloudViz(BaseViz):
Integration with the nice library at:
https://github.com/jasondavies/d3-cloud
"""
viz_type = "word_cloud"
verbose_name = "Word Cloud"
template = 'panoramix/viz_word_cloud.html'
form_fields = [
Expand Down Expand Up @@ -248,6 +252,7 @@ def get_json_data(self):


class NVD3Viz(BaseViz):
viz_type = None
verbose_name = "Base NVD3 Viz"
template = 'panoramix/viz_nvd3.html'
chart_kind = 'line'
Expand All @@ -260,8 +265,8 @@ class NVD3Viz(BaseViz):


class BubbleViz(NVD3Viz):
viz_type = "bubble"
verbose_name = "Bubble Chart"
chart_type = 'bubble'
form_fields = [
'viz_type',
('since', 'until'),
Expand Down Expand Up @@ -323,6 +328,7 @@ def get_json_data(self):
})

class BigNumberViz(BaseViz):
viz_type = "big_number"
verbose_name = "Big Number"
template = 'panoramix/viz_bignumber.html'
js_files = [
Expand Down Expand Up @@ -373,8 +379,8 @@ def get_json_data(self):


class NVD3TimeSeriesViz(NVD3Viz):
viz_type = "line"
verbose_name = "Time Series - Line Chart"
chart_type = "line"
sort_series = False
form_fields = [
'viz_type',
Expand Down Expand Up @@ -460,8 +466,8 @@ def get_json_data(self):


class NVD3TimeSeriesBarViz(NVD3TimeSeriesViz):
viz_type = "bar"
verbose_name = "Time Series - Bar Chart"
chart_type = "nvd3_bar"
form_fields = [
'viz_type',
'granularity', ('since', 'until'),
Expand All @@ -473,8 +479,8 @@ class NVD3TimeSeriesBarViz(NVD3TimeSeriesViz):


class NVD3CompareTimeSeriesViz(NVD3TimeSeriesViz):
viz_type = 'compare'
verbose_name = "Time Series - Percent Change"
chart_type = "compare"
form_fields = [
'viz_type',
'granularity', ('since', 'until'),
Expand All @@ -486,8 +492,8 @@ class NVD3CompareTimeSeriesViz(NVD3TimeSeriesViz):


class NVD3TimeSeriesStackedViz(NVD3TimeSeriesViz):
viz_type = "area"
verbose_name = "Time Series - Stacked"
chart_type = "stacked"
sort_series = True
form_fields = [
'viz_type',
Expand All @@ -500,8 +506,8 @@ class NVD3TimeSeriesStackedViz(NVD3TimeSeriesViz):


class DistributionPieViz(NVD3Viz):
viz_type = "pie"
verbose_name = "Distribution - NVD3 - Pie Chart"
chart_type = "pie"
form_fields = [
'viz_type', 'metrics', 'groupby',
('since', 'until'),
Expand Down Expand Up @@ -536,8 +542,8 @@ def get_json_data(self):


class DistributionBarViz(DistributionPieViz):
viz_type = "dist_bar"
verbose_name = "Distribution - Bar Chart"
chart_type = "column"

def get_df(self):
df = super(DistributionPieViz, self).get_df()
Expand Down Expand Up @@ -576,16 +582,18 @@ def get_json_data(self):
})


viz_types = OrderedDict([
['table', TableViz],
['line', NVD3TimeSeriesViz],
['compare', NVD3CompareTimeSeriesViz],
['area', NVD3TimeSeriesStackedViz],
['bar', NVD3TimeSeriesBarViz],
['dist_bar', DistributionBarViz],
['pie', DistributionPieViz],
['bubble', BubbleViz],
['markup', MarkupViz],
['word_cloud', WordCloudViz],
['big_number', BigNumberViz],
])
viz_types_list = [
TableViz,
NVD3TimeSeriesViz,
NVD3CompareTimeSeriesViz,
NVD3TimeSeriesStackedViz,
NVD3TimeSeriesBarViz,
DistributionBarViz,
DistributionPieViz,
BubbleViz,
MarkupViz,
WordCloudViz,
BigNumberViz,
]
# This dict is used to
viz_types = OrderedDict([(v.viz_type, v) for v in viz_types_list])

0 comments on commit 04f914f

Please sign in to comment.