javascript - jqplot 在视觉区域外渲染

标签 javascript jquery charts jqplot

我正在使用 jqplot 绘制一个简单的条形图,但是只呈现了第一个和最后一个条形图的一半。 这是图片 enter image description here

有没有办法让图表适合里面??

谢谢

更新 在 xAxis 上,我使用 dateAxisRenderer 作为渲染器。

最佳答案

axes: { xaxis: { } } 选项下,我会尝试使用:

min: null,      // minimum numerical value of the axis.  Determined automatically.
max: null,      // maximum numverical value of the axis.  Determined automatically.
pad: 1.2,       // a factor multiplied by the data range on the axis to give the
                // axis range so that data points don't fall on the edges of the axis.

选项。先敲击垫子,如果不起作用,您应该尝试将最小值和最大值设置为略大于您的数据范围。

评论编辑

我认为如果您使用自 1970/01/01 以来的毫秒数 javascript 标准,您会发现使用日期会容易得多。这就是为什么使用 min/max 作为字符串时会出错的原因。像这样指定它:

min: 1325376000 * 1000, // 2012/01/01 00:00:00
max: 1326715140 * 1000  // 2012/01/16 11:59:00

Using this min/max :

enter image description here

下一个障碍是您的约会对象没有时间。 JQPlot 将这些作为当天的第一分钟,因此它们与标签相应地对齐。如果您希望它们居中对齐,则需要指定中午 12:00 的时间。同样,您可以从字符串中解析它,但我会切换到毫秒。

关于javascript - jqplot 在视觉区域外渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8914814/

相关文章:

javascript - 如何在自定义可链接 JavaScript 库中对 querySelectorAll 选择的第一个元素调用 closest()?

javascript - 在每个 span 元素上画圆圈

jquery - jquery的性能可见

c# - 在filter mvvm c# wpf的基础上自定义wpf折线图的x轴

android - 如何在 MPAndroidChart 库中启用立方线?

javascript - 如何打开和关闭 Vuetify Carousel 组件的右/左箭头

javascript - JQuery - Javascript - .hasData() 不适合我

javascript - 从 JavaScript 返回数据到 Servlet?可能的?

javascript - 如何发送正确的 AJAX JSON?

ios - 图表 3.0 - 无法在条形图中显示小数 - iOS Swift