コード例 #1
0
ファイル: stat.py プロジェクト: ssorj/boneyard
    def make_chart_lines(self, session, chart, line_type, stats, dot_size, halo_size, line_width, samples, duration, end_secs, mode):
        chart.elements = list()
        for stat, color in reversed(zip(stats, self.colors)):
            line = Element()
            line.type = line_type
            line.fill = color
            line.fill_alpha = self.alpha
            line.on_show.type = "No"

            line.dot_style = {"type": "solid-dot",
                              "dot-size": dot_size,
                              "halo-size": halo_size}
            line.colour = color
            line.width = line_width
            tip_title = stat.title.split(" ")[-1]
            line.text = mode == "rate" and "%s / sec" % tip_title or self.get_line_title(stat)

            vals = self.get_vals(session, samples, stat, line.text, duration, end_secs)
            line.values = vals
            chart.elements.append(line)
コード例 #2
0
ファイル: stat.py プロジェクト: ssorj/boneyard
    def create(self, session, adapter, stats):
        names = self.page.names.get(session)
        values = self.page.values.get(session)
        nvs = dict()
        for name, value in zip(names, values):
            nvs[name] = value

        # move Unclaimed to end of list
        sorted_names = sorted(names)
        sorted_names.remove("Unclaimed")
        sorted_names.append("Unclaimed")

        chart = Chart()
        chart.title.text = ""
        chart.bg_colour = "#FFFFFF"

        chart.elements = list()
        element = Element()
        element.type = "pie"
        element.alpha = 7
        element.start_angle = 0
        element.gradient_fill = True
        element.radius = 90

        element.animate = list()
        animation = Element()
        animation.type = "fade"
        element.animate.append(animation)
        animation = Element()
        animation.type = "bounce"
        animation.distance = 8
        element.animate.append(animation)
        element.tip = "#percent#"

        element.colours = []
        for i in range(len(sorted_names)):
            j = i % len(self.colors)
            if sorted_names[i] == "Unclaimed":
                color = "#EEEEEE"
            else:
                color = self.colors[j]
            element.colours.append(color)
        element.colours.append("#EEEEEE")

        element.on_click = "ofc_change_priority"
        id = self.page.chart_id.get(session)
        element.on_click_text = "#percent#|#val#|#label#|%s" % id

        element.values = [{"label": x, "value": float(nvs[x])} for x in sorted_names]

        chart.elements.append(element)
        return chart.create()
コード例 #3
0
ファイル: stat.py プロジェクト: ssorj/boneyard
    def get_x_axis(self, duration, end_secs, tick_height=0):
        x_intervals = 8
        x_steps = 2
        if duration == 600:
            x_intervals = 10

        x_axis = Element()
        x_axis.colour = "#CCCCCC"
        x_axis.grid_colour = "#DDDDDD"
        x_axis.stroke = 1
        x_axis.tick_height = tick_height

        xlbls = Element()
        xlbls.size = 12
        xlbls.colour = "#999999"
        xlbls.align = "auto"
        xlbls.rotate = 0.0001

        lbls = self.get_x_labels(duration, x_intervals, x_steps, end_secs)
        xlbls.labels = lbls
        x_axis.labels = xlbls
        return x_axis