如何在任何图表上添加字幕和页脚8

时间:2017-10-17 15:17:56

标签: anychart

我正在将任意图6(xml)中的大量图表迁移到任何图表8(javascript)。我似乎无法找到如何在任何图表8中添加字幕和页脚?这些可以在任何图表6中找到。

1 个答案:

答案 0 :(得分:0)

这些功能也在最新版本中提供。请看一下目前的标题: https://docs.anychart.com/Common_Settings/Title 您可以使用HTML标记,例如

@api_view(['GET', 'POST'])
def task_list(request):
    '''
    List all tasks, or create a new task.
    '''
    if request.method == 'GET':
        tasks = Task.objects.all()
        serializer = TaskSerializer(tasks, many=True)
        return Response(serializer.data)
    elif request.method == 'POST':
        serializer = TaskSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data, status=status.HTTP_201_CREATED)
        else:
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)


# detail
@api_view(['GET', 'PUT', 'DELETE'])
def task_detail(request, pk):
    try:
        task = Task.objects.get(pk=pk)
    except Task.DoesNotExist:
        return Response(status=status.HTTP_404_NOT_FOUND)

    if request.method == 'GET':
        serializer = TaskSerializer(task)
        return Response(serializer.data)
    elif request.method == 'PUT':
        serializer = TaskSerializer(task, data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response(serializer.data)
        else:
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
    elif request.method == 'DELETE':
        task.delete()
        return Response(status=status.HTTP_204_NO_CONTENT)

它会创建副标题: https://playground.anychart.com/docs/8.0.1/samples/CS_Titles_06-plain 此外,这个例子(它与统计数据有关,但显示了这个想法):https://playground.anychart.com/docs/8.0.1/samples/CS_Statistics_05-plain

对于页脚,可以使用图表标签完成: https://docs.anychart.com/Common_Settings/Chart_Labels 您可以定义标签位置,文本内容和其他设置。我做了一个简单的例子来说明这一点:https://jsfiddle.net/sye89q5z/