Phoenix error - unsure why


Hello all, I'm exploring Phoenix charts and I have my query like this:


const ds = 'DS_Name'

const select = ['dept_code_name', 'absval', 'trx_date'];
const where = ['account = 8981', 'dept_code = 459', 'trx_date last 1 month'];
const dategrain = ['trx_date by month'];
const query = `/data/v1/${ds}?fields=${select.join()}

      console.log("Data", data);


Manually filtering my dataset, it returns 176 rows of data, which I'm also getting in the console



The issue is that it's not rendering the chart, I have it set up to a simple Bar Chart. Console is returning these messages:



Any ideas of why this happens? Let me know if you need more info or code snippets. 



  • @MartinB not seeing your code, if i had to guess you're having difficulties with asynchronous functions.


    domo.get is an async function (hence the use of .then).  so all your rendering has to happen inside the .then function unless you're using state to store the data.


    if your function is


          console.log("Data", data);
    data ... graph method


    this will fail because data doesn't exist yet when your code executes the graph method. (recall, an asynchronous function means that domo.get() does not guarantee when it'll receive a response from the API, so the rest of the code (graph method) keeps executing and ... eventually, you'll get a response from domo.get().


    if you're not comfortable with async / await (which would be a decent solution for this problem) localStorage may be an option too:

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
  • MartinB

    Yeah I fixed that last night and it worked, now I'm currently struggling with the properties of the chart (doh!) dived into the documentation as of now



This discussion has been closed.