Ejemplo n.º 1
0
    def GET(self):
        from util import AntiFraud
        input = web.input()
        rooms = input.get("rooms", "")
        rooms = rooms.replace(" ", "+")

        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)

        longLegend = "(%s)" % len(analyses)
        legend = ""
        if rooms:
            analyses = [a for a in analyses if a["rooms"].startswith(rooms)]
            groupCounts = viewer.getGroupCounts(analyses)
            longLegend = ", ".join("%s (%s)" % pair for pair in groupCounts)
            legend = ", ".join(pair[0] for pair in groupCounts)

        property = "price"
        unit = 100000
        minMax = (1*10**6, 4*10**6)
        dataJs1, maxCount1 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        minMax = (4*10**6, 7*10**6)
        dataJs2, maxCount2 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        maxCount = max(10, maxCount1, maxCount2)
        print formatter.page("histogram", _(u"Histogram of Prague Homes"),
            type="withFilter")(dataJs1, dataJs2, maxCount, longLegend)
Ejemplo n.º 2
0
    def GET(self):
        from util import AntiFraud
        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)
        timeline = charter.getTimeline(analyses)
        motionDataJs = formatter.RENDER.motionData(timeline)

        print formatter.page("chart", _(u"Chart of home prices in Prague"),
            type="withFilter")(motionDataJs)