2017-08-03 32 views

回答

0

工作得很好,對我來說。 笛卡爾圖與一系列和一些線內。 將繪製的監聽器添加到笛卡爾圖中,在笛卡爾圖(this)上調用getImage('stream'),檢查返回對象的數據元素。

我僅加入此偵聽配置笛卡爾這將在一個MessageBox顯示全圖PNG數據:

listeners: { 
     painted: function(element, eOpts) { 
      Ext.Msg.alert('Image Data', this.getImage('stream').data); 
     } 
    }, 

參見下面用於從所述文檔中的調整後全例如:

Ext.create({ 
    xtype: 'cartesian', 
    renderTo: document.body, 
    width: 600, 
    height: 400, 
    insetPadding: 40, 
    listeners: { 
     painted: function(element, eOpts) { 
      Ext.Msg.alert('Image Data', this.getImage('stream').data); 
     } 
    }, 
    store: { 
     fields: ['name', 'data1', 'data2'], 
     data: [{ 
      'name': 'metric one', 
      'data1': 10, 
      'data2': 14 
     }, { 
      'name': 'metric two', 
      'data1': 7, 
      'data2': 16 
     }, { 
      'name': 'metric three', 
      'data1': 5, 
      'data2': 14 
     }, { 
      'name': 'metric four', 
      'data1': 2, 
      'data2': 6 
     }, { 
      'name': 'metric five', 
      'data1': 27, 
      'data2': 36 
     }] 
    }, 
    axes: [{ 
     type: 'numeric', 
     position: 'left', 
     fields: ['data1'], 
     title: { 
      text: 'Sample Values', 
      fontSize: 15 
     }, 
     grid: true, 
     minimum: 0 
    }, { 
     type: 'category', 
     position: 'bottom', 
     fields: ['name'], 
     title: { 
      text: 'Sample Values', 
      fontSize: 15 
     } 
    }], 
    series: [{ 
     type: 'line', 
     style: { 
      stroke: '#30BDA7', 
      lineWidth: 2 
     }, 
     xField: 'name', 
     yField: 'data1', 
     marker: { 
      type: 'path', 
      path: ['M', - 4, 0, 0, 4, 4, 0, 0, - 4, 'Z'], 
      stroke: '#30BDA7', 
      lineWidth: 2, 
      fill: 'white' 
     } 
    }, { 
     type: 'line', 
     fill: true, 
     style: { 
      fill: '#96D4C6', 
      fillOpacity: .6, 
      stroke: '#0A3F50', 
      strokeOpacity: .6, 
     }, 
     xField: 'name', 
     yField: 'data2', 
     marker: { 
      type: 'circle', 
      radius: 4, 
      lineWidth: 2, 
      fill: 'white' 
     } 
    }] 
}); 
+0

謝謝!我發現我的錯誤代碼... –