TypeError:targetPlot.plugins未定义

时间:2014-04-25 13:59:42

标签: jquery proxy jqplot

我从标题中收到错误。我试图创建代理图表。正如您在下面的屏幕截图中看到的那样,控制器与我期望的完全不同(它应该是主图的迷你版本;变量line1,line2,line3是相同的)。我附上了整个代码:

<script type="text/javascript" src="/js/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.cursor.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.enhancedLegendRenderer.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.highlighter.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.barRenderer.min.js"></script>
<script type="text/javascript" src="/js/jqplot/plugins/jqplot.pointLabels.min.js"></script>

  $(document).ready(function()
  {
        plot1023849675 = $.jqplot('plot_1023849675', [line1, line2, line3], 
        {                            
        axes:
        {           
            xaxis: {min: '1992-01-02', max: '2014-04-24',  'numberTicks' : 7,  renderer:$.jqplot.DateAxisRenderer, tickOptions: {  formatString: '%d-%m-%y', angle: -30 }},
            yaxis: { tickOptions: {  formatString:'%.2f'}}
        },
        series:
        [
        {color:'red'  , label: 'Close'}, 
        {color:'green', label: 'Volumen',  yaxis: 'y2axis', linePattern: 'dashed'}, 
        {color:'blue' , label: 'Turnover', yaxis: 'y3axis', linePattern: 'dashed'}
        ],
        cursor: { show: true, showCursorLegend: true, showVerticalLine: true, tooltipAxisGroups: [['xaxis'], [ 'yaxis'], ['y2axis'], ['y3axis']]},
        legend: { show: true, placement: 'inside'   },
        seriesDefaults: 
        {
            showMarker:             false,
            lineWidth:              0.2,
            rendererOptions: { smooth: true, animation: {show: true  } }      
        },
        highlighter: 
        {
            show:                       true,
            showLabel:              true,
            tooltipAxes:            'y',
            showVerticalLine: true,
            sizeAdjust:             0.1 , 
            tooltipLocation : 'ne',        
        },
        axesDefaults: { fontFamily:'Helvetica', labelOptions:{ fontSize: "10px" },  tickOptions: {showGridline: false}}
    });


    controller_1023849675 = $.jqplot('controller_1023849675', [line1, line2, line3], {
        seriesDefaults:{ showMarker: false },
        series:
        [
        {color:'red'  , label: 'Close'}, 
        {color:'green', label: 'Volumen',  yaxis: 'y2axis', linePattern: 'dashed'}, 
        {color:'blue' , label: 'Turnover', yaxis: 'y3axis', linePattern: 'dashed'}
        ],
        cursor:{
        show:                       true,
        showTooltip:            false,
        zoom:                           true,
        constrainZoomTo:    'x'
        },
        axesDefaults: {
        RendererOptions: {
        alignTicks: true
      },
      axes:
        {           
            yaxis: { tickOptions: {  formatString:'%.2f'}}
        },
    }
  });

  $.jqplot.Cursor.zoomProxy(plot_1023849675, controller_1023849675);     
  $.jqplot._noToImageButton = true;

Screenshot

1 个答案:

答案 0 :(得分:0)

您需要更正此行:

$.jqplot.Cursor.zoomProxy(plot_1023849675, controller_1023849675); 

通过这个:

$.jqplot.Cursor.zoomProxy(plot1023849675, controller_1023849675); 

您需要向ZoomProxy函数提供您的targetPlot和您的controllerPlot变量(我认为targetPlot的id有一个错误(另一个下划线))