JqPlot系列切换
JqPlot seriesToggle
我正在为Javascript使用JqPlot。
我能帮我把这个系列的开关正常工作吗。在我的代码中,我有seriesTaggle:"normal"。这不起作用。图形显示得很完美,但图例显示在旁边,当我单击图形时,图例就停留在那里。显示/隐藏图例的正确代码是什么?
这是我的代码:
<script class="code" type="text/javascript">
$(document).ready(function(){
var plotCustomerSurveyGraph = $.jqplot('CustomerSurveyLineGraph', [[3.6, 3.2, 3.6], [2.4, 2.7, 2.9], [3.5, 3.1, 3.0]],
{
axes:
{
xaxis:
{
ticks: ['1','2','3'],
showTicks: false
},
yaxis:
{
//labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
ticks: ['1','2','3','4'],
showTicks: true
}
},
title:{
text: '3 Month Trends',
fontSize: 12 },
width: 480, height: 480,
legend:{show:true, location: 'e', placement: 'outsideGrid', renderer: $.jqplot.EnhancedLegendRenderer, rendererOptions: {
seriesToggle: 'normal'
//seriesToggleReplot: {resetAxes: true}
}},
seriesDefaults:
{
rendererOptions: {smooth: true}
},
series:[
{
lineWidth:1,
label:'COGS',
markerOptions: { size:7, style:'dimaond' }
},
{
lineWidth:1,
label:'Wages',
markerOptions: { size: 7, style:"dimaond" }
}
]
}
);
});
<div class="small_dash_container">
<div id="CustomerSurveyLineGraph" style="height:120px; width:220px; margin-left:10px;"></div>
</div>
<script class="include" type="text/javascript" src="elements/js/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="elements/js/jqplot/examples/syntaxhighlighter/scripts/shCore.min.js"></script>
<script type="text/javascript" src="elements/js/jqplot/examples/syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
<script type="text/javascript" src="elements/js/jqplot/examples/syntaxhighlighter/scripts/shBrushXml.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.donutRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot//plugins/jqplot.pointLabels.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot.categoryAxisRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot.barRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/examples/jquery-ui/js/jquery-ui.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.barRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.blockRenderer.min.js"></script>
<script class="include" language="javascript" type="text/javascript" src="elements/js/jqplot/plugins/jqplot.highlighter.min.j"></script>
我想您可能误解了seriesToggle
的用途。此选项的目的是允许用户单击图例中的系列名称,并在绘图中显示/隐藏相应的系列。
也就是说,如果你确实有理由隐藏图例,当点击绘图时,以下选项会将图例切换为可见和隐藏:
$('#chart1').bind('jqplotClick', function(ev, seriesIndex, pointIndex, data) {
if($('#chart1 .jqplot-table-legend').is(':visible')) {
$('#chart1 .jqplot-table-legend').hide();
}
else {
$('#chart1 .jqplot-table-legend').show();
}
});
相关文章:
- 动态更改高图中的系列颜色
- 跟踪jqplot垂直折线图的鼠标位置
- Highcharts colorsByPoint与系列中的线性渐变一起使用时不起作用
- chart.series[id].remove()无法刷新高位图表/高位股票中其他系列的图例属性
- async.js和系列问题
- 谷歌图表堆叠柱状图.如何设置每个单独堆叠项目(数据系列)的样式
- 在Ionic'中显示JSON结果;s系列重复
- 如何在tinymce编辑器中启用字体系列和颜色选项
- 应用将图表转换为图像的jqplot代码时Chrome挂起
- 如何在系列数据中包含字符串以提取工具提示点格式
- JQPlot's仪表-以针为单位显示值
- jqPlot对齐不同y轴的零
- 访问Highcharts系列的最小/最大值:afterSetExtremes不会激发
- Teechart HTML5/Javascript价值股票代码将保留在Tee.Line系列上
- 如何为 jqPlot 中的特定数据系列设置 Stack Series false
- JQPLOT 中具有多个 y 轴的多个系列
- jqPlot:可以动态添加新系列
- Jqplot:绘制系列
- JqPlot系列切换
- JQPLOT - 更改固定大小系列的轴标签的简单方法