Ejemplo n.º 1
0
 def __init__(self, height=450, width=None, **kwargs):
     NVD3Chart.__init__(self, **kwargs)
     self.create_x_axis('xAxis', format=".2f")
     self.create_y_axis('yAxis', format=".2f")
     # must have a specified height, otherwise it superimposes both chars
     if height:
         self.set_graph_height(height)
     if width:
         self.set_graph_width(width)
Ejemplo n.º 2
0
    def buildjschart(self):
        NVD3Chart.buildjschart(self)

        scatter_jschart = '\n' + stab(3) + '.showDistX(true)\n' + \
            stab(3) + '.showDistY(true)\n' + \
            stab(3) + '.color(d3.scale.category10().range())'

        start_index = self.jschart.find('.scatterChart()')
        string_len = len('.scatterChart()')
        replace_index = start_index + string_len
        if start_index > 0:
            self.jschart = self.jschart[:replace_index] + scatter_jschart + self.jschart[replace_index:]
Ejemplo n.º 3
0
    def __init__(self, height=450, width=None, date=False, **kwargs):
        NVD3Chart.__init__(self, **kwargs)
        if date:
            self.create_x_axis('xAxis', format='%d %b %Y', date=True)
            self.set_custom_tooltip_flag(True)
        else:
            self.create_x_axis('xAxis', format="r")
        self.create_y_axis('yAxis', format=".02f")

        # must have a specified height, otherwise it superimposes both chars
        if height:
            self.set_graph_height(height)
        if width:
            self.set_graph_width(width)
Ejemplo n.º 4
0
    def buildjschart(self):
        NVD3Chart.buildjschart(self)

        scatter_jschart = '\n' + stab(3) + '.showDistX(true)\n' + \
            stab(3) + '.showDistY(true)\n' + \
            stab(3) + '.color(d3.scale.category10().range())'

        start_index = self.jschart.find('.scatterChart()')
        string_len = len('.scatterChart()')
        replace_index = start_index + string_len
        if start_index > 0:
            self.jschart = self.jschart[:
                                        replace_index] + scatter_jschart + self.jschart[
                                            replace_index:]
Ejemplo n.º 5
0
    def buildjschart(self):
        NVD3Chart.buildjschart(self)

        pie_jschart = '\n' + stab(2) + 'chart.x(function(d) { return d.x })\n' + \
            stab(3) + '.y(function(d) { return d.y })\n' + \
            stab(3) + '.values(function(d) { return d });\n'
        if self.width:
            pie_jschart += stab(2) + 'chart.width(%s);\n' % self.width
        if self.height:
            pie_jschart += stab(2) + 'chart.height(%s);\n' % self.height

        start_index = self.jschart.find('.pieChart();')
        string_len = len('.pieChart();')
        replace_index = start_index + string_len
        if start_index > 0:
            self.jschart = self.jschart[:replace_index] + pie_jschart + self.jschart[replace_index:]
Ejemplo n.º 6
0
    def __init__(self, height=450, width=None, date=False, **kwargs):
        NVD3Chart.__init__(self, **kwargs)
        if date:
            self.create_x_axis('xAxis', format='%d %b %Y', date=True)
            self.set_custom_tooltip_flag(True)
        else:
            self.create_x_axis('xAxis', format=".2f")

        self.create_y_axis('y1Axis', format="f")
        self.create_y_axis('y2Axis', format="function(d) { return '$' + d3.format(',f')(d) }", custom_format=True)

        # must have a specified height, otherwise it superimposes both chars
        if height:
            self.set_graph_height(height)
        if width:
            self.set_graph_width(width)
Ejemplo n.º 7
0
    def buildjschart(self):
        NVD3Chart.buildjschart(self)

        pie_jschart = '\n' + stab(2) + 'chart.x(function(d) { return d.x })\n' + \
            stab(3) + '.y(function(d) { return d.y })\n' + \
            stab(3) + '.values(function(d) { return d })\n' + \
            stab(3) + '.color(d3.scale.category10().range());\n'
        if self.width:
            pie_jschart += stab(2) + 'chart.width(%s);\n' % self.width
        if self.height:
            pie_jschart += stab(2) + 'chart.height(%s);\n' % self.height

        start_index = self.jschart.find('.pieChart();')
        string_len = len('.pieChart();')
        replace_index = start_index + string_len
        if start_index > 0:
            self.jschart = self.jschart[:replace_index] + pie_jschart + self.jschart[replace_index:]
Ejemplo n.º 8
0
    def __init__(self, height=450, width=None, date=False, **kwargs):
        NVD3Chart.__init__(self, **kwargs)
        if date:
            self.create_x_axis('xAxis', format='%d %b %Y', date=True)
            self.set_custom_tooltip_flag(True)
        else:
            self.create_x_axis('xAxis', format=".2f")

        self.create_y_axis('y1Axis', format="f")
        self.create_y_axis(
            'y2Axis',
            format="function(d) { return '$' + d3.format(',f')(d) }",
            custom_format=True)

        # must have a specified height, otherwise it superimposes both chars
        if height:
            self.set_graph_height(height)
        if width:
            self.set_graph_width(width)