class BaseGChart(BaseChart):
class LineChart(BaseGChart):
class GaugeChart(BaseGChart):
class ColumnChart(BaseGChart):
class BarChart(BaseGChart):
class CandlestickChart(BaseGChart):
class PieChart(BaseGChart):
class TreeMapChart(BaseGChart):
class AreaChart(BaseGChart):
    def get_html_template(self):
    def get_js_template(self):
    def get_js_template(self):
    def get_js_template(self):
    def get_js_template(self):
    def get_options(self):
    def get_js_template(self):
    def get_js_template(self):
    def get_js_template(self):
    def get_js_template(self): class BaseYuiChart(BaseChart):
class LineChart(BaseYuiChart):
class SplineChart(BaseYuiChart):
class BarChart(BaseYuiChart):
class ColumnChart(BaseYuiChart):
class PieChart(BaseYuiChart):
class AreaChart(BaseYuiChart):
class AreaSplineChart(BaseYuiChart):
class ComboChart(BaseYuiChart):
class ComboSplineChart(BaseYuiChart):
class MarkerSeriesChart(BaseYuiChart):
    def get_data(self):
    def get_category_key(self):
    def get_html_template(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_data(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self): class BaseFlotChart(BaseChart):
class PointChart(BaseFlotChart):
class LineChart(BaseFlotChart):
class BarChart(BaseFlotChart):
class ColumnChart(BaseFlotChart):
class PieChart(BaseFlotChart):
    def get_serieses(self):
    def get_series_objects(self):
    def get_series_pie_objects(self):
    def get_series_objects_json(self):
    def get_options(self):
    def get_html_template(self):
    def get_js_template(self):
    def get_options(self):
    def get_options(self):
    def get_options(self):
    def get_options(self):
    def get_options(self):
    def get_js_template(self): class BaseMorrisChart(BaseChart):
class LineChart(BaseMorrisChart):
class BarChart(BaseMorrisChart):
class DonutChart(BaseMorrisChart):
class AreaChart(BaseMorrisChart):
    def get_data(self):
    def get_category_key(self):
    def get_y_keys(self):
    def get_html_template(self):
    def get_js_template(self):
    def chart_type(self):
    def chart_type(self):
    def get_data(self):
    def chart_type(self):
    def get_js_template(self):
    def chart_type(self): class BaseHighCharts(BaseChart):
class LineChart(BaseHighCharts):
class BarChart(BaseHighCharts):
class ColumnChart(BaseHighCharts):
class AreaChart(BaseHighCharts):
class ScatterChart(BaseHighCharts):
class ColumnLineChart(BaseHighCharts):
class LineColumnChart(BaseHighCharts):
class PieChart(BaseHighCharts):
class DonutChart(PieChart):
class MultiAxisChart(BaseHighCharts):
class HighMap(BaseHighCharts):
class HeatMap(BaseHighCharts):
class Funnel(BaseHighCharts):
class TreeMap(BaseHighCharts):
class PieDonut(BaseHighCharts):
class Bubble(BaseHighCharts):
    def get_html_template(self):
    def get_js_template(self):
    def get_series(self):
    def add_series_options(self, serieses):
    def get_series_json(self):
    def get_categories(self):
    def get_categories_json(self):
    def get_title(self):
    def get_title_json(self):
    def get_subtitle(self):
    def get_subtitle_json(self):
    def get_chart(self):
    def get_chart_type(self):
    def get_chart_json(self):
    def get_plot_options(self):
    def get_plot_options_json(self):
    def get_x_axis_title(self):
    def get_x_axis(self):
    def get_x_axis_json(self):
    def get_y_axis_title(self):
    def get_y_axis(self):
    def get_y_axis_json(self):
    def get_tooltip(self):
    def get_tooltip_json(self):
    def get_credits(self):
    def get_credits_json(self):
    def get_exporting(self):
    def get_exporting_json(self):
    def get_legend(self):
    def get_legend_json(self):
    def get_navigation(self):
    def get_navigation_json(self):
    def get_chart_type(self):
    def get_chart_type(self):
    def get_chart_type(self):
    def get_chart_type(self):
    def __init__(self, *args, **kwargs):
    def get_chart_type(self):
    def get_series(self):
    def calculate_single_series(self):
    def calculate_multi_series(self):
    def get_x_axis_title(self):
    def get_x_axis(self):
    def get_y_axis_title(self):
    def get_series(self):
    def get_chart_type(self):
    def get_series(self):
    def get_chart_type(self):
    def get_series(self):
    def get_plot_options(self):
    def get_chart_type(self):
    def get_chart(self):
    def get_plot_options(self):
    def get_series(self):
    def get_y_axis(self):
    def get_chart_type(self):
    def __init__(self, *args, **kwargs):
    def get_series(self):
    def calculate_multi_series(self):
    def calculate_single_series(self):
    def get_js_template(self):
    def get_map(self):
    def get_series_name(self):
    def get_color_axis(self):
    def get_color_axis_json(self):
    def get_plot_options(self):
    def get_chart_type(self):
def column(matrix, i):
def pie_column(matrix, i):
    def get_series(self):
    def get_y_axis(self):
    def get_color_axis(self):
    def get_color_axis_json(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_plot_options(self):
    def get_series(self):
    def get_chart_type(self):
    def get_plot_options(self):
def nested_list_to_tree(data):
def generate_treemap_data(root, no_of_column):
def generate_pie_donut_data(root, no_of_column):
    def get_series(self):
    def get_chart_type(self):
    def get_plot_options(self):
    def get_js_template(self):
    def get_series(self):
    def get_chart_type(self):
    def __init__(self, *args, **kwargs):
    def get_series(self):
    def calculate_single_series(self):
    def calculate_multi_series(self):
    def get_x_axis_title(self):
    def get_x_axis(self):
    def get_y_axis_title(self):
    def get_chart_type(self): class BaseC3JS(BaseChart):
class LineChart(BaseC3JS):
class BarChart(BaseC3JS):
class SplineChart(BaseC3JS):
class PieChart(BaseC3JS):
class ColumnChart(BaseC3JS):
class DonutChart(BaseC3JS):
    def get_html_template(self):
    def get_js_template(self):
    def get_categories(self):
    def get_x_axis_title(self):
    def get_columns_data(self):
    def get_chart_type(self):
    def get_chart_type(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_data(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self):
    def get_js_template(self):
    def get_chart_type(self): class BaseMatplotlibChart(BaseChart):
class LineChart(BaseMatplotlibChart):
class BarChart(BaseMatplotlibChart):
    def get_html_template(self):
    def get_serieses(self):
    def render_js(self):
    def get_image(self):
    def get_image(self): class SimpleDataSource(BaseDataSource):
    def __init__(self, data):
        """
        : param data: :type list of lists
        Example usage:
            data = [
               ['Year', 'Sales', 'Expenses', 'Items Sold', 'Net Profit'],
               ['2004', 1000, 400, 100, 600],
               ['2005', 1170, 460, 120, 310],
               ['2006', 660, 1120, 50, -460],
               ['2007', 1030, 540, 100, 200],
            ]
            sd = SimpleDataSource(data)
        """
        self.data = data

    def get_data(self):
        return self.data

    def get_header(self):
        return self.data[0]

    def get_first_column(self):
        """
        Get the first column. Generally would be the x axis.
        : return: :type list of strings
        Example:
        For the example shown in __init__, it would return the following:
            ['2004', '2005', '2006', '2007']
        """
        data_not_header = self.data[1:]
        return [el[0] for el in data_not_header] class MongoDBDataSource(SimpleDataSource):
    """ MongoDBDataSource """

    def __init__(self,
                 cursor,
                 fields,
                 *args,
                 **kwargs):

        self.cursor = cursor
        self.fields = fields
        self._doc_list = []

    def get_data(self):
        if self._doc_list:
            return self._doc_list
        doc_list = []
        doc_list.append(self.fields)
        for doc in self.cursor:
            current_row = get_row(doc, self.fields)
            doc_list.append(current_row)
        self._doc_list = doc_list
        return doc_list

    @property
    def data(self):
        return self.get_data() class ModelDataSource(SimpleDataSource):
    """
    Normalizes data contained in a queryset to format usable by renderers
    """
    def __init__(self, queryset, fields=None):
        """
        : param queryset: :type Django ORM queryset
        : param fields: :type  list of strings
        Example usage:
            queryset = Account.objects.all()
            mds = ModelDataSource(queryset, fields=['year', 'sales', 'expenses'])
            # This assumes the following model Account:
            class Account(models.Model):
                year = models.IntegerField()
                sales = models.DecimalField()
                expenses = models.DecimalField()
                profit = models.DecimalField()
        """
        self.queryset = queryset
        if fields:
            self.fields = fields
        else:
            self.fields = [el.name for el in self.queryset.model._meta.fields]
        self.data = self.create_data()

    def create_data(self):
        data = [self.fields]
        for row in self.queryset:
            data.append(get_field_values(row, self.fields))
        return data class FlotAsJson(View):
    "A view which is used to get a chart as json."
    "Subclasses should create get_context_data, which populates a chart"
    def get(self, *args, **kwargs):
        context = self.get_context_data()
        chart = context["chart"]
        label = chart.get_data()[0][1]
        return HttpResponse(json.dumps({"data": chart.get_data(), "label": label})) class RendererAsJson(View):
    "A view which is used to get a chart as json."
    "Subclasses should create get_context_data, which populates a chart"
    def get(self, *args, **kwargs):
        context = self.get_context_data()
        chart = context["chart"]
        return HttpResponse(json.dumps({"chart_data": chart.get_data()})) def get_mongo_cursor(db_name, collection_name, max_docs=100):
    import pymongo
    db = pymongo.Connection(host=DB_HOST,
                            port=DB_PORT)[db_name]
    collection = db[collection_name]
    cursor = collection.find()
    count = cursor.count
    if callable(count):
        count = count()
    if count >= max_docs:
        cursor = cursor[0:max_docs]
    return cursor DB_HOST = ["localhost"]
DB_PORT = 27017
    DB_HOST = ["localhost"]
    DB_PORT = 27017
def get_db(db_name):
def get_mongo_cursor(db_name, collection_name, max_docs=100):
def create_demo_accounts():
def create_demo_mongo():
from django.shortcuts import render, redirect
from django.views.decorators.cache import cache_page
from django.views.generic.base import TemplateView
from django.http import HttpResponse
from graphos.renderers import gchart, yui, flot, morris, highcharts, c3js, matplotlib_renderer
from graphos.sources.simple import SimpleDataSource
from graphos.sources.mongo import MongoDBDataSource
from graphos.sources.model import ModelDataSource
from graphos.views import FlotAsJson, RendererAsJson
from .models import Account
from .utils import get_mongo_cursor
from .utils import (data, candlestick_data, treemap_data, map_data, map_data_us, map_data_us_point, map_data_us_lat_lon, map_data_us_multi_series, map_data_us_multi_series_lat_lon,
                    mongo_series_object_1, mongo_series_object_2, heatmap_data, funnel_data, treemap_data_highcharts, piechart_data_highcharts,bubble_chart_data_single, bubble_chart_data_multi,
                    create_demo_accounts, create_demo_mongo, get_db, scatter_single_series_data, scatter_multi_series_data)
from .custom_charts import CustomGchart, CustomFlot, CustomFlot2
    from urllib2 import urlopen
    from urllib.request import urlopen
from dateutil.parser import parse
import json
import time
import markdown
import datetime



try:
    # python 2
except ImportError:
    # python 3



class MongoJson(FlotAsJson):
    def get_context_data(self, *args, **kwargs):
        accounts_cursor = get_db("accounts").docs.find()

        data_source = MongoDBDataSource(accounts_cursor,