Does anybody know if it is possible to create a new graph using the data in a table’s column using the command in the Numbers dictionary:
make
new type : The class of the new object.
[at location specifier] : The location at which to insert the object.
[with data any] : The initial contents of the object.
[with properties record] : The initial values for properties of the object.
→ specifier : The new object.
make new graph with data (value of every cell in column 2)
Good news: creating new graph (that is, new chart) in the Numbers.app is scriptable:
tell application "Numbers" to tell document 1 to tell sheet 1
make new chart with properties {height:209, locked:false, position:{15, 28}, width:580}
end tell
Very bad news: adding data references to the chart requires GUI scripting: 1) click on the chart (to activate it) 2) click “Add Chart Data”, 3) select “Plot Columns as Series” or “Plot Rows as Series”, 4) selecting cells, 5) clicking “Done”. :mad:
Thank you for your help Fredrik71 and KniazidisR, I’ll give it a try tomorrow.
PS Unfortunately I do not know in advance how many items I have to graph. The data are coming from a report which I parse before graphing and always has different categories and amount.
What I meant is that every time the number of categories and amounts will change.
I created a table with more rows that I’ll ever need, selected the column header and no matter how many rows contain data the pie always update correctly.