Getting data from the visualization


#1

I have a bar chart where I display topics obtained from an ES server. I also have a simple table (just an HTML table, not from ChartFactor) where I also show those topics along with some other stuffs. In this table I have my data loaded by querying directly the ES server using Ajax.

Is it possible to somehow obtain the data from the bar so I don’t have to do several queries? I guess it could be possible since the data is there right? I know ES is designed for that, but just for performance improvement :slight_smile:


Activity indicators for visualizations
#2

Yes you can and is described here. The best moment to do that is when you are defining your aql. That way you will have your data even before the visualization is rendered. Everytime you use the .execute() method it will return a promise, that once is resolved, the data will be available there

// Your bar's aql 
cf.provider('Elastic')
   .source('your_source')
   .groupby(group)
   .metric(metric)
   .graph('Bars')
   .element('elementId')
   .execute()
  .then(function (data) {
      console.log("My data is", data.data)
  })

#3

Hi @eduardo, I’m a little lost here. In the doc you posted I don’t see any visualization type defined (maybe is missing), however in your response to @diego, you do specify one. So to use the queried data, the visualization type is required or not?


#4

Actually I tried both just for fun, and it did work both ways. Specifying the visual is the one that fit for me because I actually wanted to render the bars, but now I see that is pretty useful to use it even as a data connector.