statistical-charts: line charts with several lines
Hi Tomáš (or others who might know), I’m trying to use line charts, but they work only with one line (of data): """ \usemodule[statistical-charts] \starttext \chart[line][basic][ xunit=Year, yunit=Millions of …, axesunits=yes, ][ data={7.25,2,9,3,6,5}, % works %data={{7.25,2,9,3,6,5},{0.1,0.1,0.2,0.01,0.3,0.5}}, % doesn’t xlabels={2001,2002,2003,2004,2005,2006}, ] \stoptext """ The error is: """ token call, execute: ...ontext/third/statistical-charts/t-statistical-charts.lua:1608: attempt to mul a 'string' with a 'number' stack traceback: [C]: in metamethod 'mul' ...ontext/third/statistical-charts/t-statistical-charts.lua:1608: in field 'changeaxeslength' ...ontext/third/statistical-charts/t-statistical-charts.lua:1515: in field 'all' """ I get the same error if I try to call it from Lua code with a Lua table, like \startluacode context.linechart({"basic"},{ xunit = "Year", yunit = "Millions of …", axesunits = "yes", },{ data = {7.25,2,9,3,6,5}, xlabels = {2001,2002,2003,2004,2005,2006} }) \stopluacode Additional questions: – Can I label the lines? E.g. Cows, Dodos… – Could you please document how to use the module from Lua (CLD)? Hraban
On 10/8/25 09:38, Henning Hraban Ramm wrote:
[…] \chart[line][basic][ xunit=Year, yunit=Millions of …, axesunits=yes, ][ data={7.25,2,9,3,6,5}, % works %data={{7.25,2,9,3,6,5},{0.1,0.1,0.2,0.01,0.3,0.5}}, % doesn’t
Hi Hraban, the commented line seems to require `method=struct` to accept that input.
[…] \startluacode context.linechart({"basic"},{ xunit = "Year", yunit = "Millions of …", axesunits = "yes", },{ data = {7.25,2,9,3,6,5},
`method=struct` prevents the error, but no data (or xlabels) shown. I have only use the module once, so I have no idea how to get that working. Just in case it might help, Pablo
participants (2)
-
Henning Hraban Ramm -
Pablo Rodriguez