Custom chart with timestamp from payload as the X axis

Hi,

I want to have a custom chart in my dashboard that will have data from an attribute on the Y axis and data (timestamp) from another attribute as the X axis. Is this possible?

I currently have this working by getting the data from a Data Table but from what I see in here, a Data Table should not be used for this purpose as the data will get lost after the table gets full.

How should I go about this?

thanks

Hi @Eduardo_wewer !

Indeed, we recommend using device state data to store such data. Do you mind sharing a screenshot of your current custom chart?

Sure, I am not currently using it as I can’t figure out how to only show the last ten data points but here it is:

I am using the Custom Chard option in the dashboard with this code for vega:

{ 
  "width": {{block.width}}, 
  "height": {{block.height}}, 
  "autosize": { 
    "type": "fit", 
    "contains": "padding" 
  }, 
  "data": { 
    "name": "data-table-0" 
  }, 
  "mark": "bar", 
  "encoding": { 
    "x": { 
      "field": "timestamp", 
      "type": "ordinal" 
    }, 
    "y": { 
      "field": "temperature", 
      "type": "quantitative" 
    } 
  } 
} 

Basically my payload consists of a couple of logged timestamped measurements and I need to plot them with that timestamp, so anything that would solve this problem is welcome.

thanks