Example #1
0
 def getMaxBoxOfficeFilm(self, filmNodes):
     maxVal = 0
     act = ''
     for node in filmNodes:
         if (float(FilmNode.getValue(node)) > maxVal):
             maxVal = float(FilmNode.getValue(node))
             act = FilmNode.getName(node)
     return act
Example #2
0
def show_age_gross_relation():
    ret = {}
    for film in InitGraph.filmNodes:
        if film is not None:
            value = FilmNode.getValue(film)
            name = FilmNode.getName(film)
            actors = GraphQuery.getActorsInFilm(GraphQuery(),
                                                InitGraph.filmNameDict, name)
            for actor in actors:
                if actor is not None:
                    for node in InitGraph.actorNodes:
                        if ActorNode.getName(node) == actor:
                            ret[ActorNode.getAge(node)] = value

    trace = go.Pie(labels=list(ret.keys()), values=list(ret.values()))
    py.plot([trace], filename='basic_pie_chart')
Example #3
0
def show_actor_earnings():
    ret = {}
    for film in InitGraph.filmNodes:
        if film is not None:
            value = float(FilmNode.getValue(film))
            name = FilmNode.getName(film)
            actors = GraphQuery.getActorsInFilm(GraphQuery(),
                                                InitGraph.filmNameDict, name)
            for actor in actors:
                if actor is not None:
                    if ret.get(actor) is None:
                        ret[actor] = 0.0
                    ret[actor] += value

    labels = list(ret.keys())
    values = list(ret.values())
    trace = go.Pie(labels=labels, values=values)
    py.plot([trace], filename='basic_pie_chart')
Example #4
0
 def getFilmValue(self, filmNodes, filmName):
     for node in filmNodes:
         if (FilmNode.getName(node) == filmName):
             return FilmNode.getValue(node)