Make a bar chart with array (perspective)

Hi,

I have an integer array with N elements, and want to make a bar chart (could be a line) showing the values in each array index. I´d like the index to be the X axis and the corresponding value to be the Y axis.

Which element and how ?

Thanks in advance.

Hi,
You can use Time Series Chart Bar

I tried, but when I bind the array as data source, it doesn´t work

you need to add a second data which is time and build a data with a list which takes the value of time and pressure for example


[
  {
    "time": 1560469431423,
    "Pressure": 12
  },
  {
    "time": 1560469432423,
    "Pressure": 42
  },
  {
    "time": 1560469433423,
    "Pressure": 81
  },
  {
    "time": 1560469434423,
    "Pressure": 11
  }
]

The OP has categories and values, not timestamps and values. The Time Series Chart is the wrong component for the job.

Rodrigo, can you show the binding on the data property?
If it is an SQL query please show that as well formatted as code.

Hi,

The binding is just a tag. An array of 24+1 integers. I want to show the production of something by hour. Each index will be an hour of the day, and its values will be the total produced. It´s Edge, I don´t have databases, that´s why I'm using tags.

Add a script transform to your tag binding:

def transform(self, value, quality, timestamp):
	newData = []
	for i in range(len(value)):
		newData.append({"hour": i, "produced": value[i]})
	return newData

Set
xAxes.0.name : hour
xAxes.0.render : category
yAxes.0.name : produced
xAxes.0.render : value
and do the usual good stuff in series.0....