Help with Error msg: Data column(s) for axis #0 cannot be of type string (chartmaker plus extension)

Hi all, i tried to create a graph based data stored in tinydb. However, I keep receiving the error message "Data column(s) for axis #0 cannot be of type string". Need advice to fix it.

Blocks to plot graph:

Blocks to feed data to tinydb

A guess, perhaps circled values are strings and arrowed similar values are not

Thanks, but apparently, the same error was displayed after multiplying 1 to each of them.

Show the content of global DataList

You need to be sending an arrayTable in a format like this:

[["HeaderX","HeaderY1","HeaderY2"],["1",2,3],["2",4,6],["3",5,7]]

The first sublist must be strings, the first item of each subsequent sublist can be either astring or a number (but you cannot mix them), the remaining items must be numbers.

Extension blocks do not look correct (different from the ones in my posted extension...)

Extension blocks?

It appears you are using a procedure to call the chartmakerplus extension ?

Hi, @Timai2, thank you for your feedback but I am not very sure about your comments. I've rewritten part of the program and I think I've two questions:

  1. Did I use my extension right?
  2. Is the handling of list of lists (which were taken from the TinyDb) right?

I've attached my program (PlotGraph & BloodPressure screens are the ones I work on.) Would you be please point out the problems?

Thanks. [edit aia removed - not sure if any paid extensions there]

OK, I see whee the difference in the extension blocks is, you have used blocks from the any Component drawer. Use blocks from the extension's drawer instead:

image

To get the chart working, I suggest you set yourself up a simple example to see how you need to feed the data as a list, then adjust your data inputs accordingly.

e.g.

image

I thought mine is similar to the one in the following page (linechart):

At the moment, ListView2 outputs:
(Date AVSYS AVDIA AVPulse)
(["811", 1 1 1])
(["812", 3 3 3])
(["815", 7.5 7.5 7.5])

But I know it accepts only:
(Date AVSYS AVDIA AVPulse)
("811", 1 1 1)
("812", 3 3 3)
("815", 7.5 7.5 7.5)

But don't know how? Any advice?

Show the content of global Data_AV, BEFORE you put it in a listview. (Either use Do It in companion, or set to a label.)

Do you have list set to JSON in Screen1 properties ?

Do you have list set to JSON in Screen1 properties ?
Yes I did.

Show the content of global Data_AV, BEFORE you put it in a listview. (Either use Do It in companion, or set to a label.)

What I mean is that if I am to use the ChartMakerPlus, I need to prepare the data in list of lists form as follows:
(Date AVSYS AVDIA AVPulse)
("811", 1 1 1)
("812", 3 3 3)
("815", 7.5 7.5 7.5)

However, as of now, using the codes I displayed in my previous post, I ended up generating lists of tuples:
(Date AVSYS AVDIA AVPulse)
(["811", 1 1 1])
(["812", 3 3 3])
(["815", 7.5 7.5 7.5])

But I've no ideas of how to convert [...] into list so that the data can be fed into the chartmakerPlus block to plot the graph.
i.e.
(["811", 1 1 1]) ---> ("811" 1 1 1)

If you have Lists as Json ticked, why are you showing lists with parentheses () ?

I need to understand your list structure then I can advise on how you resolve the problem. At the moment it appears you have contrived to build a list structure like this:

[
["Date", "AVSYS", "AVDIA", "AVPulse"],
[ ["811", [1, 1, 1] ] ], 
[ ["812", [3, 3, 3] ] ], 
[ ["815", [7.5, 7.5, 7.5] ] ] 
]

which as you correctly say, will not work

If it helps it should look like this:

[
["Date", "AVSYS", "AVDIA", "AVPulse"],
["811", 1, 1, 1],
["812", 3, 3, 3],
["815", 7.5, 7.5, 7.5]
]

I've attached the aia file for you to have a look at.
Blood_Pressure_Speech_Save_Version_104_3_0_Building_test.aia (662.0 KB)

The reason why I show the lists with parentheses is because I read it from the output on the mobile phone during my test run the App. A screen capture is provided below.

In the first viewlist above, the data are in the form of ["815" 7.5 7.5 7.5] ... So, I've no clue of how to make them into ("815" 7.5 7.5 7.5).

Your aia project is throwing up internal errors for me, I am unable to enter data to see exactly what is happening. However, by creating some sample data I can draw a chart:

Your issue is with either how you are storing your data in the tinyDB, or how you are extracting it to create a list (or both!)

It is probably here (on the Plot graph screen):

I recommend you stop trying to look at your data in a listview and put it in a label, then you can more clearly see the list structure your blocks are generating

I agree. The above blocks show how I store data to Tinydb and the previous post showed how I output the data. I encountered error msges when I first open the aia file but, after cancelling the error msg, you'll be okay.

Look closely at the content of your tinyDB, and how your data is structured, then use this knowledge to extract the data you want to your Data_AV list.

I get internal error messages when trying to change to any other screen....

Can you try this version:
Blood_Pressure_20210816_3.aia (621.8 KB)

You may:
(1) Record Health data - SYS, DIA, PULSE; followed by a chosen date, enter to confirm
(2) View Health Data - to view data entered
(3) Credits - to display the data prepared for plotting graph. However, the records at present are not in the form of list of lists.

Try this:

generates a chart for me

image

Also, see here: Strings and Numbers