如何定义图表的jqPlot大小 [英] How to define the size of graph in jqPlot

查看:219
本文介绍了如何定义图表的jqPlot大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jqPlot来呈现网页上的图形。

I am using jqPlot to render a graph on a page.

我下面这个链接。
http://www.jqplot.com/tests/bar-charts.php

中的数据点,我给图是动态的。所以有时图形的尺寸是不同的。有没有一种方法/或能够为jqPlot设置属性?

The data point that I give to the graph are dynamic. so sometime the size of the graph is different. Is there a way/or able to set property for jqPlot?

要为precise,问题是如何设置的高度和图形的宽度,这样我每次得到新的数据标签的图形和尺寸的大小总是一样的。用的jsfiddle一个例子帮助大家包括我自己。

To be precise, the question is how to set the height and width of graph so that every time I get new data the size of the graph and size of labels are always same. An example with jsFiddle would help everyone including myself.

推荐答案

您可以通过配置高度宽度

$.jqplot('chartdiv', [data],
{
    height: 400,
    width: 400,
    ...

您还需要给高度宽度目标DIV:

You also need to give the height and width to the target div:

<div id="chartdiv" style="height:500px; width:500px;"></div>

这篇关于如何定义图表的jqPlot大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆