Axis label in Flot

后端 未结 9 1246
长情又很酷
长情又很酷 2021-01-31 14:15

Does anyone know how one can set the label or title of an axis in Flot?

I\'ve read the API but it doesn\'t seem to have that feature...

Thanks :)

9条回答
  •  情歌与酒
    2021-01-31 15:08

    Example for 2dims graph (x and y axis) solved with pure css.

    Y axis:

    #placeholder:after {
        content: 'Speed';
        position: absolute;
        top: 50%;
        left: -50px;
        font-weight: 600;
        /* Safari */
        -webkit-transform: rotate(-90deg);
        /* Firefox */
        -moz-transform: rotate(-90deg);
        /* IE */
        -ms-transform: rotate(-90deg);
        /* Opera */
        -o-transform: rotate(-90deg);
        /* Internet Explorer */
        filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
    }
    

    X axis:

    #placeholder:before {
        content: 'Time';
        position: absolute;
        bottom: -30px;
        left: 50%;
        font-weight: 600;
    }
    

提交回复
热议问题