XY Chart not refreshing data from dataSources

Hi,

I have a XY Chart set up with 4 dataSources. I had to change the query to get proper data, and since then my data source called Shift C is showing the same data as Shift A.
If I expand the tree or open the binding, I can confirm this data source has no data.
I see the same in the web browser. I cleared the cache and tried to open it in private tab. It shows the same issue as in the Designer.

Does anyone know or had this before?

Thanks,

I think we'll need to see the chart JSON. Copy the chart into another view and then make sure that the bindings are removed (so that we get the actual data). Copy the XY Chart from the Project Browswer and paste it here using the </> button to preserve indentation and apply syntax highlighting.

[
  {
    "type": "ia.chart.xy",
    "version": 0,
    "props": {
      "title": {
        "text": "Daily Efficiency By Machine",
        "appearance": {
          "font": {},
          "padding": {
            "bottom": 10
          }
        }
      },
      "legend": {
        "markers": {
          "width": 10,
          "height": 10
        },
        "labels": {
          "font": {
            "size": 10
          }
        }
      },
      "selection": {
        "enabled": true
      },
      "xAxes": [
        {
          "name": "Day",
          "label": {
            "enabled": false,
            "text": "Day",
            "color": ""
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "date",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": true,
              "timeUnit": "day",
              "count": 1,
              "skipEmptyPeriods": false
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "yyyy/MM/dd",
            "format": "M/d"
          },
          "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,
              "rotation": 0,
              "verticalCenter": "middle",
              "horizontalCenter": "middle"
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": 1,
              "position": 0
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        }
      ],
      "yAxes": [
        {
          "name": "Efficiency",
          "label": {
            "enabled": false,
            "text": "Efficiency",
            "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": 1.2,
              "min": 0,
              "useStrict": true
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 100,
              "endValue": 110,
              "size": 5
            },
            "format": "###.##%"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "",
              "opacity": 1,
              "rotation": 0,
              "verticalCenter": "middle",
              "horizontalCenter": "middle"
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": 20,
              "position": 0
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        },
      
 
    "meta": {
      "name": "XYChart"
    },
    "position": {
      "x": 146,
      "y": 168,
      "height": 375,
      "width": 435,
      "grow": 1
    },
    "custom": {},
    "propConfig": {
      "props.dataSources.ShiftA": {
        "binding": {
          "type": "query",
          "config": {
            "polling": {
              "enabled": true,
              "rate": "3600"
            },
            "queryPath": "Efficiency/GetDailyEfficiencyByShiftByMachine",
            "parameters": {
              "Shift": "2",
              "Machine": "00-01"
            }
          },
          "transforms": [
            {
              "code": "\toutput_json = []\n\tTarget = 0.865\n\t\t\t\n\tfor row in range(value.getRowCount()):\t\t\n\t\trow_object = {}\n\t\trow_value = {}\n\t\tfor col in range(value.getColumnCount()):    \n\t\t\trow_value[value.getColumnName(col)] = value.getValueAt(row, col)\n\t\t\trow_object['value'] = row_value\n\t\t\t\n\t\t\trow_value['Target'] = Target\n\t\t\tTotal = value.getValueAt(row,3)\n\t\t\n\t\t\tif Total < 0.865:\n\t\t\t\trow_value['Color'] = '#962A2A' \n\t\t\telse:\n\t\t\t\trow_value['Color'] = '#008000'\t\n\t\n\t\toutput_json.append(row_value)\n\t\t\t\n\treturn output_json",
              "type": "script"
            }
          ]
        },
        "persistent": false
      },
      "props.dataSources.ShiftB": {
        "binding": {
          "type": "query",
          "config": {
            "polling": {
              "enabled": true,
              "rate": "3600"
            },
            "queryPath": "Efficiency/GetDailyEfficiencyByShiftByMachine",
            "parameters": {
              "Shift": "'3'",
              "Machine": "00-01"
            }
          },
          "transforms": [
            {
              "code": "\toutput_json = []\n\tTarget = 0.865\n\t\t\t\n\tfor row in range(value.getRowCount()):\t\t\n\t\trow_object = {}\n\t\trow_value = {}\n\t\tfor col in range(value.getColumnCount()):    \n\t\t\trow_value[value.getColumnName(col)] = value.getValueAt(row, col)\n\t\t\trow_object['value'] = row_value\n\t\t\t\n\t\t\trow_value['Target'] = Target\n\t\t\tTotal = value.getValueAt(row,3)\n\t\t\n\t\t\tif Total < 0.865:\n\t\t\t\trow_value['Color'] = '#962A2A' \n\t\t\telse:\n\t\t\t\trow_value['Color'] = '#008000'\t\n\t\n\t\toutput_json.append(row_value)\n\t\t\t\n\treturn output_json",
              "type": "script"
            }
          ]
        },
        "persistent": false
      },
      "props.dataSources.ShiftC": {
        "binding": {
          "type": "query",
          "config": {
            "polling": {
              "enabled": true,
              "rate": "3600"
            },
            "queryPath": "Efficiency/GetDailyEfficiencyByShiftByMachine",
            "parameters": {
              "Shift": "'1'",
              "Machine": "00-01"
            }
          },
          "transforms": [
            {
              "code": "\toutput_json = []\n\tTarget = 0.865\n\t\t\t\n\tfor row in range(value.getRowCount()):\t\t\n\t\trow_object = {}\n\t\trow_value = {}\n\t\tfor col in range(value.getColumnCount()):    \n\t\t\trow_value[value.getColumnName(col)] = value.getValueAt(row, col)\n\t\t\trow_object['value'] = row_value\n\t\t\t\n\t\t\trow_value['Target'] = Target\n\t\t\tTotal = value.getValueAt(row,3)\n\t\t\n\t\t\tif Total < 0.865:\n\t\t\t\trow_value['Color'] = '#962A2A' \n\t\t\telse:\n\t\t\t\trow_value['Color'] = '#008000'\t\n\t\n\t\toutput_json.append(row_value)\n\t\t\t\n\treturn output_json",
              "type": "script"
            }
          ]
        },
        "persistent": true
      },
      "props.dataSources.Total": {
        "binding": {
          "type": "query",
          "config": {
            "polling": {
              "enabled": true,
              "rate": "36000"
            },
            "queryPath": "Efficiency/GetDailyEfficiencyByMachine",
            "parameters": {
              "Machine": "00-01"
            }
          }
        },
        "persistent": false
      },
      "props.style.fontSize": {
        "binding": {
          "type": "property",
          "config": {
            "path": "view.params.width"
          },
          "transforms": [
            {
              "code": "\twidth = self.session.custom.width\n\tif value < width:\n\t\treturn 10\n\telse:\n\t\treturn ''",
              "type": "script"
            }
          ]
        },
        "persistent": true
      },
      "props.title.appearance.font.size": {
        "binding": {
          "type": "property",
          "config": {
            "path": "this.props.style.fontSize"
          }
        }
      }
    }
  }
]

I have new data coming from binding every day.
It updates the chart properly, but the series C Shift keeps showing the data for A Shift even though there is nothing on its data source.

Sorry for the delay. I was travelling.

You seem to have missed this instruction.

As a result there is no data in the dataSources but only the query bindings that we can't run.

Can you edit your second post to fix it (rather than leave the useless code there)?

Thanks.

Thanks. I just fixed the code. I hope it's okay now.
I've copied the chart to a new view, then the issue is gone.

[
  {
    "type": "ia.chart.xy",
    "version": 0,
    "props": {
      "title": {
        "text": "Daily Efficiency By Machine",
        "appearance": {
          "font": {},
          "padding": {
            "bottom": 10
          }
        }
      },
      "legend": {
        "markers": {
          "width": 10,
          "height": 10
        },
        "labels": {
          "font": {
            "size": 10
          }
        }
      },
      "selection": {
        "enabled": true
      },
      "xAxes": [
        {
          "name": "Day",
          "label": {
            "enabled": false,
            "text": "Day",
            "color": ""
          },
          "visible": true,
          "tooltip": {
            "enabled": true,
            "text": "",
            "cornerRadius": 3,
            "pointerLength": 4,
            "background": {
              "color": "",
              "opacity": 1
            }
          },
          "inversed": false,
          "render": "date",
          "category": {
            "break": {
              "enabled": false,
              "startCategory": "",
              "endCategory": "",
              "size": 0.05
            }
          },
          "date": {
            "baseInterval": {
              "enabled": true,
              "timeUnit": "day",
              "count": 1,
              "skipEmptyPeriods": false
            },
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            },
            "break": {
              "enabled": false,
              "startDate": "",
              "endDate": "",
              "size": 0.05
            },
            "inputFormat": "yyyy/MM/dd",
            "format": "M/d"
          },
          "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,
              "rotation": 0,
              "verticalCenter": "middle",
              "horizontalCenter": "middle"
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": 1,
              "position": 0
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        }
      ],
      "yAxes": [
        {
          "name": "Efficiency",
          "label": {
            "enabled": false,
            "text": "Efficiency",
            "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": 1.2,
              "min": 0,
              "useStrict": true
            },
            "logarithmic": false,
            "break": {
              "enabled": false,
              "startValue": 100,
              "endValue": 110,
              "size": 5
            },
            "format": "###.##%"
          },
          "appearance": {
            "opposite": false,
            "inside": false,
            "labels": {
              "color": "",
              "opacity": 1,
              "rotation": 0,
              "verticalCenter": "middle",
              "horizontalCenter": "middle"
            },
            "grid": {
              "color": "",
              "opacity": 1,
              "dashArray": "",
              "minDistance": 20,
              "position": 0
            },
            "font": {
              "size": "",
              "weight": 500
            }
          }
        },
        {
          "appearance": {
            "font": {
              "size": "",
              "weight": 500
            },
            "grid": {
              "color": "",
              "dashArray": "",
              "minDistance": 0,
              "opacity": 0,
              "position": 0
            },
            "inside": true,
            "labels": {
              "color": "",
              "horizontalCenter": "middle",
              "opacity": 1,
              "rotation": 0,
              "verticalCenter": "middle"
            },
            "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 HH:mm:ss",
            "inputFormat": "yyyy-MM-dd kk:mm:ss",
            "range": {
              "max": "",
              "min": "",
              "useStrict": false
            }
          },
          "inversed": false,
          "label": {
            "color": "",
            "enabled": true,
            "text": ""
          },
          "name": "ManPower",
          "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": 1.2,
              "min": 0,
              "useStrict": false
            }
          },
          "visible": false
        }
      ],
  
      "dataSources": {
        "ShiftC": []
      }
    },
    "meta": {
      "name": "XYChart"
    },
    "position": {
      "x": 192.5,
      "y": 179,
      "height": 375,
      "width": 435,
      "grow": 1
    },
    "custom": {},
    "propConfig": {
      "props.dataSources.ShiftA": {
        "persistent": false
      },
      "props.dataSources.ShiftB": {
        "persistent": false
      },
      "props.dataSources.ShiftC": {
        "persistent": true
      },
      "props.dataSources.Total": {
        "persistent": false
      },
      "props.style.fontSize": {
        "binding": {
          "type": "property",
          "config": {
            "path": "view.params.width"
          },
          "transforms": [
            {
              "code": "\twidth = self.session.custom.width\n\tif value < width:\n\t\treturn 10\n\telse:\n\t\treturn ''",
              "type": "script"
            }
          ]
        },
        "persistent": true
      },
      "props.title.appearance.font.size": {
        "binding": {
          "type": "property",
          "config": {
            "path": "this.props.style.fontSize"
          }
        }
      }
    }
  }
]

That happens sometimes. Something gets confused somewhere and a clean start can fix it.

I set up the new view again with the bindings and the parameters, and it's happening again.
I have other charts set up like this with no issues. Not sure if there is a cache in the gateway doing it.

When I paste the code of post #7 above into my view's root container I get this:
ShiftC is empty

There is only ShiftC and it contains no data.
If you follow my original instructions carefully you should be able to post valid code (and then edit the previous questions to remove the non-functional code).

I'm sorry it didn't copy everything. If I go to the chart in Project Browser and copy it, I get the same code pasted above.
If I copy only the dataSource, I get the data below. The Shift C should not have any data, so it is correct although it's showing Shift A data.

{
  "ShiftC": [],
  "Total": {
    "$": [
      "ds",
      192,
      1694101489119
    ],
    "$columns": [
      {
        "name": "Plant",
        "type": "String",
        "data": [
          "03",
          "03",
          "03",
          "03",
          "03"
        ]
      },
      {
        "name": "Date",
        "type": "String",
        "data": [
          "2023-09-07",
          "2023-09-06",
          "2023-09-05",
          "2023-09-01",
          "2023-08-31"
        ]
      },
      {
        "name": "Machine",
        "type": "String",
        "data": [
          "0001",
          "0001",
          "0001",
          "0001",
          "0001"
        ]
      },
      {
        "name": "Total",
        "type": "Double",
        "data": [
          null,
          0.27071428571428574,
          0.42500000000000004,
          0.24357142857142858,
          0.3173333333333333
        ]
      },
      {
        "name": "Color",
        "type": "String",
        "data": [
          "#008000",
          "#962A2A",
          "#962A2A",
          "#962A2A",
          "#962A2A"
        ]
      },
      {
        "name": "Target",
        "type": "Double",
        "data": [
          0.865,
          0.865,
          0.865,
          0.865,
          0.865
        ]
      }
    ]
  },
  "ShiftA": [
    {
      "Shift": "2",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": null,
      "Date": "2023-09-07",
      "Machine": "0001"
    },
    {
      "Shift": "2",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.23142857142857146,
      "Date": "2023-09-06",
      "Machine": "0001"
    },
    {
      "Shift": "2",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.42500000000000004,
      "Date": "2023-09-05",
      "Machine": "0001"
    },
    {
      "Shift": "2",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.17428571428571435,
      "Date": "2023-09-01",
      "Machine": "0001"
    },
    {
      "Shift": "2",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.35124999999999995,
      "Date": "2023-08-31",
      "Machine": "0001"
    }
  ],
  "ShiftB": [
    {
      "Shift": "3",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.31,
      "Date": "2023-09-06",
      "Machine": "0001"
    },
    {
      "Shift": "3",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.31285714285714283,
      "Date": "2023-09-01",
      "Machine": "0001"
    },
    {
      "Shift": "3",
      "Plant": "03",
      "Target": 0.865,
      "Color": "#008000",
      "Total": 0.2785714285714285,
      "Date": "2023-08-31",
      "Machine": "0001"
    }
  ]
}