Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django制图与Chartit(highcharts包装器)_Django_Highcharts_Django Views - Fatal编程技术网

Django制图与Chartit(highcharts包装器)

Django制图与Chartit(highcharts包装器),django,highcharts,django-views,Django,Highcharts,Django Views,对于django的一个项目,我试图绘制一个演员所拍电影的收视率/年数。我使用Django chartit绘制图表,因为它只是highcharts的包装。我想知道是否有一种方法可以使它成为这样,当您将鼠标移到图形中的某个点上时,它会显示更多细节。现在它只显示x/y信息,即年份/评级,但我也希望它显示更多细节,例如电影的名称。电影模型包含了很多我想包含的细节,但我在Chartit的文档中没有看到如何做到这一点 我的视图代码如下所示: def film_chart_view(request):

对于django的一个项目,我试图绘制一个演员所拍电影的收视率/年数。我使用Django chartit绘制图表,因为它只是highcharts的包装。我想知道是否有一种方法可以使它成为这样,当您将鼠标移到图形中的某个点上时,它会显示更多细节。现在它只显示x/y信息,即年份/评级,但我也希望它显示更多细节,例如电影的名称。电影模型包含了很多我想包含的细节,但我在Chartit的文档中没有看到如何做到这一点

我的视图代码如下所示:

def film_chart_view(request):
    if 'q' in request.GET and request.GET['q']:
        q = request.GET['q']
        # grab the first person on the list
        person_search = Person.objects.filter(short = q)[0]
    #Step 1: Create a DataPool with the data we want to retrieve.
        filmdata = \
            DataPool(
               series=
                [{'options': {
                   'source': person_search.film_set.all()},
                  'terms': [
                    'year', 'rating', 'name']}
                 ])

        #Step 2: Create the Chart object
        cht = Chart(
                datasource = filmdata,
                series_options =
                  [{'options':{
                      'type': 'line',
                      'stacking': False},
                    'terms':{
                      'year': [
                        'rating',]
                      }}],
                chart_options =
                  {'title': {
                       'text': 'Ratings'},
                   'xAxis': {
                        'title': {
                           'text': 'Year'}}})

        #Step 3: Send the chart object to the template.
        return render_to_response('home/search_results.html',{'filmchart': cht})
我基本上希望当你将鼠标移到图表上的某个点上时,弹出更多的信息


我想知道这在chartit中是否可行,或者我是否必须放弃它,直接使用highcharts?

您最终找到了向chartit中的弹出窗口添加信息的方法吗?