Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
174 views
in Technique[技术] by (71.8m points)

python 三引号 格式化输出

`

category = [{'name': '权益', 'y': 46.089999999999996}, {'name': '债券', 'y': 25.029999999999998}, {'name': '货币', 'y': 0.0}, {'name': '另类', 'y': 15.37}, {'name': 'QDII', 'y': 0.0}, {'name': '其他', 'y': 0.0}]

'''

    function initChart4(){
            Highcharts.setOptions({"global": {useUTC: false}, "lang": {}});
            var option = {
                chart: {
                    type: 'area',
                    renderTo: "chart-4"
                }, 
                colors: ['#ff3030', '#7cb5ec'], 
                credits: {
                    enabled: false
                }, 
                legend: {
                    enabled: true
                }, 
                plotOptions: {
                    series: {
                        compare: "percent"
                    }
                }, 
                rangeSelector: {
                    selected: 3
                }, 
                title: {
                    text: "动态回撤", 
                    align: "left",
                    style: {
                        fontSize: '15px'
                    }
                }, 
                tooltip: {
                    pointFormat: "<span style=\"color:{series.color}\"><b>{series.name}</b></span>: {point.y} ({point.change}%)<br/>", 
                    valueDecimals: 2
                }, 
                yAxis: {
                    reversed: true,
                    offset: 25,
                    labels: {
                        formatter: function () {
                            return this.value + '%';
                        }
                    },
                    plotLines: [{
                        value: 0, 
                        width: 0.05, 
                        dashStyle: 'dot', 
                        color: "silver"}]
                }
            };

            var chart = new Highcharts.StockChart(option);
            var data = %r;
        var dataLen = data.length;
        for (var ix = 0; ix < dataLen; ix++) {
            chart.addSeries(data[ix]);
        }
    }

''' % category

`

ValueError: unsupported format character ')' (0x29) at index 1185


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...