Perspective XY Chart not plotting

Hello All,

I am facing weird issue with XY series chart in perspective module.
I am querying 3 columns (Date_Time, floatValue-column 1, floatValue-column 2) and forming a required JSON using script transform which returns correct data.

It does return array with keys as column names and values as present. However it does not plot a chart.
What happens is suppose my

Date_Time: 2021-12-08 10:24:08
floatValue-column 1: -3.84
floatValue-column 2: 0.84

If my array values are like this it doesn’t plot anything on chart. But when I type any valid in any one of floatValue- column X manually it does plot a chart for that column only.

At first I thought this is because there’re spaces in my keyName but I tried replacing it with underscore and still the issue is there.
I could post snips if needed.

Please advise.

Ignition Version: 8.1.1

yes more info required, post the whole json of the chart

Here you go:


[
  {
    "type": "ia.chart.xy",
    "version": 0,
    "props": {
      "xAxes": [
        {
          "name": "time",
          "label": {
            "enabled": true,
            "text": "Time",
            "color": ""
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "category",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": false,
              "timeUnit": "hour",
              "count": 1,
              "skipEmptyPeriods": false
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "yyyy-MM-dd kk:mm:ss",
            "format": "MM/dd HH:mm:ss"
          },
          "value": {
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 0,
              "endValue": 100,
              "size": 0.05
            },
            "format": "#,###.##"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "",
              "opacity": 1
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": 60,
              "position": 0.5
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        }
      ],
      "yAxes": [
        {
          "name": "process temp",
          "label": {
            "enabled": true,
            "text": "Process Temp",
            "color": ""
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "value",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": false,
              "timeUnit": "hour",
              "count": 1,
              "skipEmptyPeriods": false
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "yyyy-MM-dd kk:mm:ss",
            "format": "M/d/yyyy HH:mm:ss"
          },
          "value": {
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 0,
              "endValue": 100,
              "size": 0.05
            },
            "format": "#,###.##"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "",
              "opacity": 1
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": null,
              "position": 0.5
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        },
        {
          "appearance": {
            "font": {
              "size": "",
              "weight": 500
            },
            "grid": {
              "color": "",
              "dashArray": "4,4",
              "minDistance": null,
              "opacity": 1,
              "position": 0.5
            },
            "inside": false,
            "labels": {
              "color": "",
              "opacity": 1
            },
            "opposite": true
          },
          "category": {
            "break": {
              "enabled": false,
              "endCategory": "",
              "size": 0.05,
              "startCategory": ""
            }
          },
          "date": {
            "baseInterval": {
              "count": 1,
              "enabled": false,
              "skipEmptyPeriods": false,
              "timeUnit": "hour"
            },
            "break": {
              "enabled": false,
              "endDate": "",
              "size": 0.05,
              "startDate": ""
            },
            "format": "M/d/yyyy",
            "inputFormat": "yyyy-MM-dd kk:mm:ss",
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            }
          },
          "inversed": false,
          "label": {
            "color": "",
            "enabled": true,
            "text": "Output Temp"
          },
          "name": "output temp",
          "render": "value",
          "tooltip": {
            "background": {
              "color": "",
              "opacity": 1
            },
            "cornerRadius": 3,
            "enabled": true,
            "pointerLength": 4,
            "text": ""
          },
          "value": {
            "break": {
              "enabled": false,
              "endValue": 100,
              "size": 0.05,
              "startValue": 0
            },
            "format": "#,###.##",
            "logarithmic": false,
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            }
          },
          "visible": true
        }
      ],
      "series": [
        {
          "name": "process temp",
          "label": {
            "text": "Process Temp"
          },
          "visible": true,
          "hiddenInLegend": false,
          "defaultState": {
            "visible": true
          },
          "data": {
            "source": "example",
            "x": "Date_Time",
            "y": "621-G54 Y Axis Pull Amount"
          },
          "xAxis": "time",
          "yAxis": "process temp",
          "zIndex": 0,
          "tooltip": {
            "enabled": true,
            "text": "{name}: [bold]{valueY}[/]",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "render": "line",
          "candlestick": {
            "open": {
              "x": "",
              "y": ""
            },
            "high": {
              "x": "",
              "y": ""
            },
            "low": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "fill": {
                "color": "",
                "opacity": 1
              },
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              },
              "stacked": false,
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "heatRules": {
                "enabled": false,
                "max": "",
                "min": "",
                "dataField": ""
              }
            }
          },
          "column": {
            "open": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "fill": {
                "color": "",
                "opacity": 1
              },
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              },
              "stacked": false,
              "width": null,
              "height": null,
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "heatRules": {
                "enabled": false,
                "max": "",
                "min": "",
                "dataField": ""
              }
            }
          },
          "line": {
            "open": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "connect": true,
              "tensionX": 1,
              "tensionY": 1,
              "minDistance": 0.5,
              "stroke": {
                "width": 3,
                "opacity": 1,
                "color": "",
                "dashArray": ""
              },
              "fill": {
                "opacity": 0,
                "color": ""
              },
              "bullets": [
                {
                  "enabled": false,
                  "render": "circle",
                  "width": 10,
                  "height": 10,
                  "label": {
                    "text": "{value}",
                    "position": {
                      "dx": 0,
                      "dy": 0
                    }
                  },
                  "fill": {
                    "color": "",
                    "opacity": 1
                  },
                  "stroke": {
                    "color": "",
                    "opacity": 1,
                    "width": 1
                  },
                  "rotation": 0,
                  "tooltip": {
                    "enabled": true,
                    "text": "{name}: [bold]{valueY}[/]",
                    "cornerRadius": 3,
                    "pointerLength": 4,
                    "background": {
                      "color": "",
                      "opacity": 1
                    }
                  },
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    },
                    "rotation": ""
                  },
                  "heatRules": {
                    "enabled": false,
                    "max": 100,
                    "min": 2,
                    "dataField": ""
                  }
                }
              ]
            }
          },
          "stepLine": {
            "open": {
              "x": "",
              "y": ""
            },
            "appearance": {
              "connect": true,
              "tensionX": 1,
              "tensionY": 1,
              "minDistance": 0.5,
              "stroke": {
                "width": 3,
                "opacity": 1,
                "color": "",
                "dashArray": ""
              },
              "fill": {
                "opacity": 0,
                "color": ""
              },
              "bullets": [
                {
                  "enabled": true,
                  "render": "circle",
                  "width": 10,
                  "height": 10,
                  "label": {
                    "text": "{value}",
                    "position": {
                      "dx": 0,
                      "dy": 0
                    }
                  },
                  "fill": {
                    "color": "",
                    "opacity": 1
                  },
                  "stroke": {
                    "color": "",
                    "opacity": 1,
                    "width": 1
                  },
                  "rotation": 0,
                  "tooltip": {
                    "enabled": true,
                    "text": "{name}: [bold]{valueY}[/]",
                    "cornerRadius": 3,
                    "pointerLength": 4,
                    "background": {
                      "color": "",
                      "opacity": 1
                    }
                  },
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    },
                    "rotation": ""
                  },
                  "heatRules": {
                    "enabled": false,
                    "max": 100,
                    "min": 2,
                    "dataField": ""
                  }
                }
              ]
            }
          }
        },
        {
          "candlestick": {
            "appearance": {
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "fill": {
                "color": "",
                "opacity": 1
              },
              "heatRules": {
                "dataField": "",
                "enabled": false,
                "max": "",
                "min": ""
              },
              "stacked": false,
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              }
            },
            "high": {
              "x": "",
              "y": ""
            },
            "low": {
              "x": "",
              "y": ""
            },
            "open": {
              "x": "",
              "y": ""
            }
          },
          "column": {
            "appearance": {
              "deriveFieldsFromData": {
                "fill": {
                  "color": "",
                  "opacity": ""
                },
                "stroke": {
                  "color": "",
                  "opacity": "",
                  "width": ""
                }
              },
              "fill": {
                "color": "",
                "opacity": 1
              },
              "heatRules": {
                "dataField": "",
                "enabled": false,
                "max": "",
                "min": ""
              },
              "height": null,
              "stacked": false,
              "stroke": {
                "color": "",
                "opacity": 1,
                "width": 1
              },
              "width": null
            },
            "open": {
              "x": "",
              "y": ""
            }
          },
          "data": {
            "source": "example",
            "x": "Date_Time",
            "y": "622-G55 X Axis Pull Amount"
          },
          "defaultState": {
            "visible": true
          },
          "hiddenInLegend": false,
          "label": {
            "text": "Output Temp"
          },
          "line": {
            "appearance": {
              "bullets": [
                {
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "rotation": "",
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    }
                  },
                  "enabled": false,
                  "fill": {
                    "color": "",
                    "opacity": 1
                  },
                  "heatRules": {
                    "dataField": "",
                    "enabled": false,
                    "max": 100,
                    "min": 2
                  },
                  "height": 10,
                  "label": {
                    "position": {
                      "dx": 0,
                      "dy": 0
                    },
                    "text": "{value}"
                  },
                  "render": "circle",
                  "rotation": 0,
                  "stroke": {
                    "color": "",
                    "opacity": 1,
                    "width": 1
                  },
                  "tooltip": {
                    "background": {
                      "color": "",
                      "opacity": 1
                    },
                    "cornerRadius": 3,
                    "enabled": true,
                    "pointerLength": 4,
                    "text": "{name}: [bold]{valueY}[/]"
                  },
                  "width": 10
                }
              ],
              "connect": true,
              "fill": {
                "color": "",
                "opacity": 0
              },
              "minDistance": 0.5,
              "stroke": {
                "color": "#FF0000",
                "dashArray": "",
                "opacity": 1,
                "width": 3
              },
              "tensionX": 1,
              "tensionY": 1
            },
            "open": {
              "x": "",
              "y": ""
            }
          },
          "name": "output temp",
          "render": "line",
          "stepLine": {
            "appearance": {
              "bullets": [
                {
                  "deriveFieldsFromData": {
                    "fill": {
                      "color": "",
                      "opacity": ""
                    },
                    "rotation": "",
                    "stroke": {
                      "color": "",
                      "opacity": "",
                      "width": ""
                    }
                  },
                  "enabled": true,
                  "fill": {
                    "color": "",
                    "opacity": 1
                  },
                  "heatRules": {
                    "dataField": "",
                    "enabled": false,
                    "max": 100,
                    "min": 2
                  },
                  "height": 10,
                  "label": {
                    "position": {
                      "dx": 0,
                      "dy": 0
                    },
                    "text": "{value}"
                  },
                  "render": "circle",
                  "rotation": 0,
                  "stroke": {
                    "color": "",
                    "opacity": 1,
                    "width": 1
                  },
                  "tooltip": {
                    "background": {
                      "color": "",
                      "opacity": 1
                    },
                    "cornerRadius": 3,
                    "enabled": true,
                    "pointerLength": 4,
                    "text": "{name}: [bold]{valueY}[/]"
                  },
                  "width": 10
                }
              ],
              "connect": true,
              "fill": {
                "color": "",
                "opacity": 0
              },
              "minDistance": 0.5,
              "stroke": {
                "color": "",
                "dashArray": "",
                "opacity": 1,
                "width": 3
              },
              "tensionX": 1,
              "tensionY": 1
            },
            "open": {
              "x": "",
              "y": ""
            }
          },
          "tooltip": {
            "background": {
              "color": "",
              "opacity": 1
            },
            "cornerRadius": 3,
            "enabled": true,
            "pointerLength": 4,
            "text": "{name}: [bold]{valueY}[/]"
          },
          "visible": true,
          "xAxis": "time",
          "yAxis": "output temp",
          "zIndex": 0
        }
      ],
      "dataSources": {}
    },
    "meta": {
      "name": "XYChart_0"
    },
    "position": {
      "breakpoints": [
        {
          "colIndex": 0,
          "name": "sm",
          "order": 9,
          "rowIndex": 1,
          "span": 5
        },
        {
          "colIndex": 0,
          "name": "md",
          "order": 9,
          "rowIndex": 1,
          "span": 5
        },
        {
          "colIndex": 0,
          "name": "lg",
          "order": 9,
          "rowIndex": 1,
          "span": 5
        }
      ],
      "height": 343
    },
    "custom": {},
    "propConfig": {
      "props.dataSources.example": {
        "binding": {
          "type": "property",
          "config": {
            "path": "../Table.props.data"
          },
          "transforms": [
            {
              "code": "\tpyD = system.dataset.toPyDataSet(value)\n\tcolNames = list(value.getColumnNames())\n\tkeyNames = [colNames[0]]+colNames[3:]\n\tdateCol = value.getColumnAsList(0)\n\tvalues = [value.getColumnAsList(value.getColumnIndex(keyName)) for keyName in keyNames]\n\n\tdata1 = []\n\trecord = {}\n\tfor i in range(len(pyD)):\n\t\tfor j in range(len(values)):\n\t\t\tif keyNames[j] != 'Date_Time':\n\t\t\t\trecord[keyNames[j]] = round(float(values[j][i]),3)\n\t\t\telse:\n\t\t\t\trecord[keyNames[j]] = values[j][i]\n\t\tdata1.append(record)\n\treturn data1\n\t\n\t'''\n\tdata = []\n\tfor row in pyD:\n\t\tdata.append({\"Date_Time\": row['Date_Time'],\n\t\tcolNames[3]: \"%.2f\" %float(row[3]),\n\t\t\"622-G55 X Axis Pull Amount\": \"%.2f\" %float(row[4])})\n\treturn data\n\t'''\n\t\n#\t[\n#\t  {\n#\t    \"Date_Time\": \"Tue Dec 10 2021\",\n#\t    \"621-G54 Y Axis Pull Amount\": 0.61,\n#\t    \"622-G55 X Axis Pull Amount\": 1.48\n#\t  },\n#\t  {\n#\t    \"Date_Time\": \"Tue Dec 11 2021\",\n#\t    \"621-G54 Y Axis Pull Amount\": 1.49,\n#\t    \"622-G55 X Axis Pull Amount\": 0.54\n#\t  },\n#\t  {\n#\t    \"Date_Time\": \"Tue Dec 12 2021\",\n#\t    \"621-G54 Y Axis Pull Amount\": 0.65,\n#\t    \"622-G55 X Axis Pull Amount\": 2.07\n#\t  }\n#\t]",
              "type": "script"
            }
          ]
        }
      }
    }
  }
]

eh could you create a copy of the data in json format too?
(or just the first 5 entries)

though it seems you are still using the default axes/series names, maybe that is the problem?


[
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  },
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  },
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  },
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  },
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  },
  {
    "Date_Time": "2021-12-08 10:10:43",
    "622-G55 X Axis Pull Amount": -3.109,
    "621-G54 Y Axis Pull Amount": 0.855
  }
]

Here is the data bind to it. I’m also pasting script below:


value and return a result.

	Arguments:
		self: A reference to the component this binding is configured on.
		value: The incoming value from the binding or the previous transform.
		quality: The quality code of the incoming value.
		timestamp: The timestamp of the incoming value as a java.util.Date
	"""
	pyD = system.dataset.toPyDataSet(value)
	colNames = list(value.getColumnNames())
	keyNames = [colNames[0]]+colNames[3:]
	dateCol = value.getColumnAsList(0)
	values = [value.getColumnAsList(value.getColumnIndex(keyName)) for keyName in keyNames]

	data1 = []
	record = {}
	for i in range(len(pyD)):
		for j in range(len(values)):
			if keyNames[j] != 'Date_Time':
				record[keyNames[j]] = round(float(values[j][i]),3)
			else:
				record[keyNames[j]] = values[j][i]
		data1.append(record)
	return data1

No I series is not a problem here as I made sure it’s the same Y-Axis name as column name. Also if series were wrong, it shouldn’t have worked when I manually change the values.

@victordcq

I have updated the previous JSON and script. I posted the wrong earlier that I was testing by replacing space with underscore

Are you sure in the code you post i see the default values...

Ah nvm... a bit confusing tho xD

the data you provided is 5times the same xd

anyways i adjusted the data and its displaying. So maybe its the binding that isnt working correct

try adding some logs to be sure these values are always values that can get parsed to floats
system.perspective.print(values[j][i])
system.perspective.print(type(values[j][i]))

I see but I checked for one record which was returning float. That should’ve plotted a graph at least.

And are you sure its returning a bunch of different numbers? cuz the sample you gave me was all the same values xd which ofc doesnt show anything