繁体   English   中英

jQuery Flot Chart标签未显示

[英]Jquery Flot Chart label not showing

因此,我正在学习浮点图,但是在使用选项时,很难显示标签或图例。 某些选项会起作用(例如行的fill和fillColor),但其他选项不会吗? 在桌子上敲我的头

由于某种原因,它在jsfiddle中根本没有显示,但在我的Web应用程序中却显示。

<h1>Flot Examples</h1>
<div id="placeholder" class="placeholder" style="width:500px; height:300px; background-color:darkcyan;"  runat="server">

<script type="text/javascript">
    var data, data1, dataTime, options, chart;
    var date = new Date(); //2015
    var date1 = date.setDate(date.getDate());
    var date2 = date.setDate(date.getDate() - 365); //2015
    var date3 = new Date(date.getFullYear() - 2, date.getMonth() - 5, date.getDate() - 6);

    dataTime = [
        [date1, 1],
        [date2, 3],
        [date3, 6]
    ];
    data2 = [dataTime];

    data1 = [
        [1, 4],
        [2, 5],
        [3, 6],
        [4, 9],
        [5, 7],
        [6, 6],
        [7, 2],
        [8, 1],
        [9, 3]
    ];
    data = [data1];
    options = {
        series: {
            //bars: { show: true }
            lines: {
                show: true,
                // fill: true,
                //fillColor: "#000000"
            },

        },
        xaxis: {
            mode: "time"
        },
        yaxis: {
            min: 1
        },
        selection: {
            mode: "x"
        },
        grid: {
            show: true
        },
        //   clickable: true,
        // hoverable: true,
        shadowSize: 20,
        highlightColor: "#ffffff", //this is the color of the circle that appears
        label: {
            string: "invisible"
        },
        tooltip: true,
        legend: {
            show: true,
            labelBoxBorderColor: "#ffffff",
            position: "ne",
            margin: 10,
            backgroundColor: "#66ccff",

        }

    };

    $(document).ready(function() {
        //  chart1 = $.plot($('<%= placeholder.ClientID %>'), data, options);
        chart1 = $.plot($(".placeholder"), data2, options);
    });
</script>![enter image description here][1]

我建议将此插件用于轴标签: https : //github.com/markrcote/flot-axislabels 它使您可以非常简单地为x和y轴添加标签。

暂无
暂无

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

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