首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试使用justpy使高海图瀑布图工作,得到“JSON值结束后的意外文本”

尝试使用justpy使高海图瀑布图工作,得到“JSON值结束后的意外文本”
EN

Stack Overflow用户
提问于 2022-10-21 11:39:46
回答 1查看 14关注 0票数 0

我正在尝试使用justpy来实现高海图瀑布图的工作,在JSON值结束后得到“意想不到的文本”。有人能在下面发现会导致html错误的错误吗?某个角色是不应该出现的?我对HTML没有很好的眼光。我正在使用python中的justpy应用程序来运行图表,谢谢

代码语言:javascript
复制
import justpy as jp

chart_def="""
{
    chart: {
        type: 'waterfall'
    },

    title: {
        text: 'Highcharts Waterfall'
    },

    xAxis: {
        type: 'category'
    },

    yAxis: {
        title: {
            text: 'USD'
        }
    },

    legend: {
        enabled: false
    },

    tooltip: {
        pointFormat: '<b>${point.y:,.2f}</b> USD'
    },

    series: [{
            name: 'Start',
            y: 120000
        }, {
            name: 'Product Revenue',
            y: 569000
        }, {
            name: 'Service Revenue',
            y: 231000
        }, {
            name: 'Positive Balance',
            isIntermediateSum: true
        }, {
            name: 'Fixed Costs',
            y: -342000
        }, {
            name: 'Variable Costs',
            y: -233000
        }, {
            name: 'Balance',
            isSum: true
        }],
        dataLabels: {
            enabled: true
            },
            style: {
                fontWeight: 'bold'
            }
        },
        pointPadding: 0
    }]
}
"""

def app():
    wp = jp.QuasarPage()
    h1 = jp.QDiv(a=wp, text="Title here",classes="text-h2 text-center q-pa-md")
    hc = jp.HighCharts(a=wp,options=chart_def)    
    return wp

jp.justpy(app)
EN

回答 1

Stack Overflow用户

发布于 2022-10-21 12:09:25

您的系列配置似乎有错误。尝试以下代码:

代码语言:javascript
复制
{
  chart: {
    type: 'waterfall'
  },

  title: {
    text: 'Highcharts Waterfall'
  },

  xAxis: {
    type: 'category'
  },

  yAxis: {
    title: {
      text: 'USD'
    }
  },

  legend: {
    enabled: false
  },

  tooltip: {
    pointFormat: '<b>${point.y:,.2f}</b> USD'
  },

  series: [{
    data: [{
      name: 'Start',
      y: 120000
    }, {
      name: 'Product Revenue',
      y: 569000
    }, {
      name: 'Service Revenue',
      y: 231000
    }, {
      name: 'Positive Balance',
      isIntermediateSum: true
    }, {
      name: 'Fixed Costs',
      y: -342000
    }, {
      name: 'Variable Costs',
      y: -233000
    }, {
      name: 'Balance',
      isSum: true
    }],

    dataLabels: {
      enabled: true
    },
    style: {
      fontWeight: 'bold'
    },
    pointPadding: 0
  }]
}

演示: https://jsfiddle.net/BlackLabel/80zfLta2/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74153065

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档