我有一个使用jQPlot的折线图,需要在点击jquery移动弹出窗口时显示.不幸的是它没有出现..下面是我的代码.
<!DOCTYPE html>
<html>
<head>
<title>Line Charts and Options</title>
<link class="include" rel="stylesheet" type="text/css" href="jquery.mobile-1.3.0.css" />
<link class="include" rel="stylesheet" type="text/css" href="jquery.jqplot.min.css" />
<script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.3.0.js"></script>
<script type="text/javascript" src="jquery.jqplot.min.js"></script>
<script type="text/javascript" src="jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="jqplot.canvasAxisLabelRenderer.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="content">
<img src="downarrow_Green.svg" onclick="openpopup()"/>
<div id="mychartshow" style="height:150px; width:150px;"></div>
<div data-role="popup" id="ExchangeRate_graph" data-theme="c" align="left">
<div class="ui-grid-d">
<div class="ui-block-a" align="left">
<span>1y</span>
</div>
<div class="ui-block-b" align="left">
<span>6m</span>
</div>
<div class="ui-block-c" align="left">
<span>3m</span>
</div>
<div class="ui-block-d" align="left">
<span>1m</span>
</div>
<div class="ui-block-e" align="left"> …Run Code Online (Sandbox Code Playgroud) 我在jq绘图条形图的显示工具提示中遇到问题我的jqPlot代码是
<script class="code" type="text/javascript">
$(document).ready(function(){
var s1 = [0,10,20,30,40,50,60,70,80,90,100];
var s2 = [-100,-90,-80,-70,-60,-50,-40,-30,-20,-10,-0];
var ticks = ['01-jun','02-jun','03s-jun','04-jun','05-jun','06-jun','07-jun','08-jun','09-jun','10-jun'];
var plot1 = $.jqplot('chart1', [s1, s2], {
animate: !$.jqplot.use_excanvas,
stackSeries: true,
seriesDefaults:{
renderer:$.jqplot.BarRenderer,
rendererOptions: {fillToZero: true, barPadding: 10,barMargin: 15},
pointLabels: { show: true }
},
series: [
{ color: '#68BA38',label:'Uptime' },
{ color: 'red',label:'Downtime' },
{ label:'abcd' }
],
legend: {
show: true,
placement: 'outsideGrid'
},
axes: {
// Use a category axis on the x axis and use our custom ticks.
xaxis: …Run Code Online (Sandbox Code Playgroud) 我只是玩jqplot几个小时,但我找不到如何以更具体的jquery方式指定目标.例如,如果我有HTML代码:
<div id="chart"></div>
Run Code Online (Sandbox Code Playgroud)
我可以使用创建图表
$.jqplot("chart", [], {});
Run Code Online (Sandbox Code Playgroud)
它将在id:chart的元素上创建一个图表.
我想要的是使用这样的东西:
$("#chart").jqplot([], {});
Run Code Online (Sandbox Code Playgroud)
要么
$(".multiple_charts").jqplot([], {});
Run Code Online (Sandbox Code Playgroud)
要么
var myChart=$("<div></div>");
myChart.jqplot([], {});
Run Code Online (Sandbox Code Playgroud)
我看到这个问题已在2009年提出:https://bitbucket.org/cleonello/jqplot/issue/114/jqplot-target-should-accept-any-element
我正在寻找什么解决方案?谢谢
我想知道是否可以以编程方式突出显示标记上的标记.
我有一个折线图和一个单独的数据网格.
单击折线图中的标记将突出显示数据网格中的相关行,单击数据网格中的行将突出显示折线图中的相关标记.
在下面的例子中,我可以做第一个要求.$('#chartdiv').bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data)返回我可以用来查找相关数据网格行的数据点.
但我坚持反过来.
在我的例子中,为了简单起见,我用一个按钮替换了datagrid.
有一种SetSelectedMarker或类似的方法我不知道吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>jqPlot examples</title>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/jquery.jqplot.1.0.0r1095/dist/excanvas.min.js"></script><![endif]-->
<!-- jQuery runtime minified -->
<script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.7.1.min.js" type="text/javascript"></script>
<style type="text/css">
ul.tooltip
{
list-style-type:none;
padding:0px;
margin:0px;
}
</style>
<script class="include" type="text/javascript" src="js/jquery.jqplot.1.0.0r1095/dist/jquery.jqplot.min.js"></script>
<script class="include" type="text/javascript" src="js/jquery.jqplot.1.0.0r1095/dist/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script class="include" type="text/javascript" src="js/jquery.jqplot.1.0.0r1095/dist/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script class="include" type="text/javascript" src="js/jquery.jqplot.1.0.0r1095/dist/plugins/jqplot.highlighter.js"></script>
<script type="text/javascript">
// We use a document ready jquery function. …Run Code Online (Sandbox Code Playgroud) 如何在缩放操作后重新设置ticks的formatString?
我$.jqplot.DateAxisRenderer在"xaxis"上使用插件formatString = "%d.%m",但是当我缩放时,我想%d.%m %H:%M:%S根据新的最小值和最大值来改变它.
假设您有一个图表中显示的系列的线图.当您使用EnhancedLegendRenderer打开和关闭系列时,系列会在隐藏和可见之间切换.这就是应该如何.但事实上,我希望系列保持可见的比例,以便具有最高y值的系列将位于图表的顶部,同时调整y轴上的值.下图显示了当我将具有最高值的系列切换为隐藏时的外观.
这样做有简单或先进的方法吗?我试图从图表中完全删除系列,从数据中删除它,并创建一个新的jqplot.但那时它在传奇中也不可见.还尝试了使用chart.series [i] .show = false的不同方法; chart.replot(); 等,但结果相同.
情节图片http://i45.tinypic.com/52mn8m.png 情节图片http://i48.tinypic.com/vp9ker.png
我正在使用jqPlot创建图表.图表的数据点来自使用GSON构建的JSON对象.图表数据点以JavaScript数组格式构建,因此保存要发送到客户端的数据的Java对象存储数据,如下所示:
String chartDataPoints = "[[1352128861000, 0.0], [1352128801000, 0.0], [1352128741000, 0.0], [1352128681000, 0.0], [1352128621000, 0.0],...More chart points in this format ,[[x0,y0], [x1,y2]...]]";
Run Code Online (Sandbox Code Playgroud)
x点是日期.
是否可以直接从JSON对象传递此数据,就好像它是一个JavaScript数组?目前,MyJsonObject.chartDataPoints被视为String,因此jqPlot($ .jqplot('chart1',MyJsonObject.chartDataPoints)不会绘制任何内容.
我正在使用jqPlot在一些网页上显示许多图表.我希望能够将这些图表保存到图像文件中.
做这个的最好方式是什么?是否可以在图表上使用右键菜单选项,以便将图表保存到图像文件中?
以下是我的一个图表的一些代码:
var plotCogsLineGraph = $.jqplot('FinancialsLineGraph', [[30,31,34,40,45], [34,38,31,42,38]],
{
axes:
{
xaxis:
{
ticks: ['5','4','3','2','1']
},
yaxis:
{
label:'%',
pad: 1.05,
ticks: ['0','15','30','45','60']
}
},
width: 480, height: 270,
legend:{show:true, location: 's', placement: 'insideGrid', renderer: $.jqplot.EnhancedLegendRenderer},
seriesDefaults:
{
rendererOptions: {smooth: true}
},
series:[
{
lineWidth:1,
label:'COGS',
markerOptions: { size:1, style:'dimaond' }
},
{
lineWidth:1,
label:'Wages',
markerOptions: { size: 1, style:"dimaond" }
}
]
}
);
Run Code Online (Sandbox Code Playgroud)
需要在上面的代码中添加什么才能将图形保存到图像文件中?
我正在使用以下内容将图例成功放置在JQPlot折线图之外:
legend:{show:true,location:'sw',placement:'outside'},
但是,这使得图例太靠近图表,与我的yaxis标签一致.我需要将它进一步向左移动.有没有办法做到这一点?
谢谢.
当我尝试使用IE8下的jqplot初始化图形时,我收到了js错误.
错误发生在:
return window.G_vmlCanvasManager.initElement(P)
Run Code Online (Sandbox Code Playgroud)
在jquery.jqplot.min.js文件中.
错误是关于:"属性initElement未定义或null"
我该如何解决这个问题?
此外,同样的错误出现在jqplot 的官方网站上.
我正在使用IE11与IE8仿真器模式.IE> 8 =>没问题.