简体   繁体   English

chart.js图表​​的y轴混乱

[英]y-axis of chart.js charts is scrambled

So I'm generating graphs with chart.js. 所以我正在用chart.js生成图形。 For some reason, the Y-axis is completely scrambled which makes no sense! 由于某种原因,Y轴被完全打乱了,这毫无意义! Would anybody know how to fix this? 有人知道如何解决这个问题吗? Here's my code: 这是我的代码:

chart.js生成的图形

  <script type="text/javascript">

    var chartDataSource2 = {{ json_encode($micromarket_participants) }};


        $(function () {
            $("#chartContainer2").dxChart({
                dataSource:                 chartDataSource2,
                commonSeriesSettings:       {argumentField: 'id'},
                series:                     [      
                                                {
                                                name:       'minSingleCareFee',            
                                                valueField: 'minSingleCareFee',
                                                type:       'bar' 
                                                },                                           
                                            ]
            });
        })


</script>

    <div id="chartContainer1" style="height:400px;"></div>

im just having the same with u and i found what the problem is. 即时消息只是与您相同,我发现了问题所在。 hope its useful for u. 希望它对你有用。

error may occur in the datasource for numbers, u have to pass the array to the chart.js function without any "" 数字的数据源中可能会发生错误,您必须将数组传递给chart.js函数,而不带任何“”

for example, dataSource = [{time:"08:00", a: 10, b :10}]; 例如,dataSource = [{time:“ 08:00”,a:10,b:10}];

but not dataSource = [{time:"08:00", a: "10", b :"10"}]; 但不是dataSource = [{time:“ 08:00”,a:“ 10”,b:“ 10”}];

then the y-axis would come back! 然后y轴会回来! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM