最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using JQPlot, how can I place the legend outside the chart in a specific location? - Stack Overflow

programmeradmin4浏览0评论

I am using the following to successfully place the legend outside my JQPlot line chart:

legend: {
   show: true,
   location: 'sw',
   placement: 'outside'
},

However, this places the legend too close to the chart, in line with my yaxis labeling. I need to move it further to the left. Is there a way to do this?

I am using the following to successfully place the legend outside my JQPlot line chart:

legend: {
   show: true,
   location: 'sw',
   placement: 'outside'
},

However, this places the legend too close to the chart, in line with my yaxis labeling. I need to move it further to the left. Is there a way to do this?

Share Improve this question edited Oct 3, 2022 at 11:49 Donald Duck 8,90223 gold badges79 silver badges102 bronze badges asked Jul 20, 2013 at 21:54 Shane GeistShane Geist 311 gold badge1 silver badge3 bronze badges 2
  • refer to this post, i have posted the answer is-it-possible-to-write-legend-to-a-separate-division-with-jqplot – Gyandeep Commented Jul 21, 2013 at 8:04
  • Here is the answer, maybe some other developers needs. stackoverflow./a/20047827/2371672 – burakerk Commented Oct 13, 2015 at 8:21
Add a ment  | 

3 Answers 3

Reset to default 7

A bit late, sure, but I got it! You should use placement: 'outsideGrid' instead of placement: 'outside' as 'outsideGrid' will shrink the graph area for the legend not to be mixed with it.

Checkout the marginTop, marginRight, marginBottom, marginLeft properties for Legend.

You should be able to do:

legend: { 
    show: true, 
    location: 'sw', 
    placement: 'outside',
    marginLeft: 300
}

You have to use it like this. marginLeft : "300px"

legend: { 
    show: true, 
    location: 'sw', 
    placement: 'outside',
    marginLeft: "300px"
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论