English 中文(简体)
Jqplot: 积极贴上标签和X-轴标
原标题:Jqplot: Get the labels and x-axis ticks dynamically

I m working on jqplot with groovy on grails. I am passing the data as a list and I want to populate the labels and x-axis ticks. For one label it is working fine but how can I iterate?

             series:[ 
                {label: ${labelList[0]} },
                {label: aaa },
                {label: bbb },
                {label: ccc },
                {label: ddd }
            ],

I am not using Json object. So any help for above problem will be appreciated. Thanks.

问题回答

如果我获得你的权利,你想要能够在你的法典中随意树立一些标签? 您可使用<条码>Java 字典/代码>建立阵列系列,然后将其编成系列图。

var labelList = ["Label1", "L2", "Oi", "Bro"];
var series = [];

for(var i = 0; i < labelList.length; i++){
    var label = labelList[i];
    console.log("label = "+label);
    series.push({label:label});
}
for(var i = 0; i < series.length ; i++)
    console.log("series[i] = "+series[i].label);

http://jsfiddle.net/eDek4/"rel=“nofollow”> 这里是工作守则样本

随后,在您的图表中:

$.jqplot( chart , [data], {
   series: series
});




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签