* lmt_chart_bar with data from luacode [not found] <8298719e-3e97-4525-ba6f-c168fef2788f@Spark> @ 2021-07-23 9:07 ` Jorge Manuel 2021-07-23 15:58 ` Hans Hagen 0 siblings, 1 reply; 5+ messages in thread From: Jorge Manuel @ 2021-07-23 9:07 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1119 bytes --] Dear Sirs If I tried: \starttext \startluacode sample = {10,30,30,40} function MP.GetP() mp.print(sample) end \stopluacode \startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, samples = {lua.MP.GetP()} , trace = true, maximum = 100, linewidth = 1mm, showlabels = false, originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode \stoptext This works. But with an extra element in the sample table: \starttext \startluacode sample = {10,30,30,40,50} function MP.GetP() mp.print(sample) end \stopluacode \startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, samples = {lua.MP.GetP()} , trace = true, maximum = 100, linewidth = 1mm, showlabels = false, originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode \stoptext Don't works anymore. Why? Thanks for your time and support. Sent with a Spark [-- Attachment #1.2: Type: text/html, Size: 1975 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lmt_chart_bar with data from luacode 2021-07-23 9:07 ` lmt_chart_bar with data from luacode Jorge Manuel @ 2021-07-23 15:58 ` Hans Hagen 2021-07-23 21:56 ` Jorge Manuel 0 siblings, 1 reply; 5+ messages in thread From: Hans Hagen @ 2021-07-23 15:58 UTC (permalink / raw) To: mailing list for ConTeXt users, Jorge Manuel On 7/23/2021 11:07 AM, Jorge Manuel wrote: > Dear Sirs > > If I tried: > > \starttext > \startluacode > sample = {10,30,30,40} > > function MP.GetP() > mp.print(sample) > end > \stopluacode > > \startMPcode > draw lmt_chart_bar [ > width = 8cm, > height = 10mm, > samples = {lua.MP.GetP()} , > trace = true, > maximum = 100, > linewidth = 1mm, > showlabels = false, > originsize = 0, > labelanchor = "lft", > labelcolor = "black" > labelstyle = "bfxx" > legendstyle = "tfxx", > labelstrut = "yes", > ] ; > \stopMPcode > > \stoptext > > This works. > > But with an extra element in the sample table: > > \starttext > \startluacode > sample = {10,30,30,40,50} > > function MP.GetP() > mp.print(sample) > end > \stopluacode > > \startMPcode > draw lmt_chart_bar [ > width = 8cm, > height = 10mm, > samples = {lua.MP.GetP()} , > trace = true, > maximum = 100, > linewidth = 1mm, > showlabels = false, > originsize = 0, > labelanchor = "lft", > labelcolor = "black" > labelstyle = "bfxx" > legendstyle = "tfxx", > labelstrut = "yes", > ] ; > \stopMPcode > > \stoptext > > Don't works anymore. Why? (watch out: samples is global in your code) your lua.MP.GetP() becomes some mp quantity and 4 entries becomes a cmykcolor and you're just lucky that that works (reverse casting makes it a table) and there is no 5 element quantity so, you end up in scantokens not being able to understand it I'll think of a way to pass records (new submechanism) at some point but for now i added this: \startluacode document.samples = { { 10, 30, 30, 40, 50 } } \stopluacode \startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, trace = true, maximum = 100, linewidth = 1mm, showlabels = false, sampleset = "document.samples", originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode with the spec being some lua, so this will also work: sampleset = "table.load('foo.lua')", asuming foo.lua has this: return { { 10, 30, 30, 40, 50 } } ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lmt_chart_bar with data from luacode 2021-07-23 15:58 ` Hans Hagen @ 2021-07-23 21:56 ` Jorge Manuel 2021-07-24 7:40 ` Floris van Manen 0 siblings, 1 reply; 5+ messages in thread From: Jorge Manuel @ 2021-07-23 21:56 UTC (permalink / raw) To: mailing list for ConTeXt users, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 1293 bytes --] Dear Hans I tried this code, but it didn't work. This is not my day. %%%%%%%%%%%%%%% \starttext \startluacode document.samples = { { 10, 30, 30, 40, 50 } } function document.dados() return { { 10, 30, 30, 40, 50 }} end \stopluacode \startMPcode draw lmt_chart_bar [ samples = "table.load('document.dados')", percentage = true, cumulative = true, showlabels = false, backgroundcolor = "lightgray", ] ; \stopMPcode \startMPcode draw lmt_chart_bar [ width = 8cm, height = 10mm, trace = true, maximum = 100, linewidth = 1mm, showlabels = false, samples = "document.samples", originsize = 0, labelanchor = "lft", labelcolor = "black" labelstyle = "bfxx" legendstyle = "tfxx", labelstrut = "yes", ] ; \stopMPcode \stoptext %%%%%%%%%%%%%%%%%%%%% Jorge Magalhães On 23 Jul 2021, 16:58 +0100, Hans Hagen <j.hagen@xs4all.nl>, wrote: > > \startMPcode > > draw lmt_chart_bar [ > width = 8cm, > height = 10mm, > trace = true, > maximum = 100, > linewidth = 1mm, > showlabels = false, > sampleset = "document.samples", > originsize = 0, > labelanchor = "lft", > labelcolor = "black" > labelstyle = "bfxx" > legendstyle = "tfxx", > labelstrut = "yes", > ] ; > \stopMPcode [-- Attachment #1.2: Type: text/html, Size: 2374 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lmt_chart_bar with data from luacode 2021-07-23 21:56 ` Jorge Manuel @ 2021-07-24 7:40 ` Floris van Manen 2021-07-24 7:44 ` Jorge Manuel 0 siblings, 1 reply; 5+ messages in thread From: Floris van Manen @ 2021-07-24 7:40 UTC (permalink / raw) To: ntg-context On 23/07/2021 23:56, Jorge Manuel wrote: > > I tried this code, but it didn't work. This is not my day. Using the latest version made it work here. .F ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: lmt_chart_bar with data from luacode 2021-07-24 7:40 ` Floris van Manen @ 2021-07-24 7:44 ` Jorge Manuel 0 siblings, 0 replies; 5+ messages in thread From: Jorge Manuel @ 2021-07-24 7:44 UTC (permalink / raw) To: ntg-context, mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 93 bytes --] Good Morning Yes, this works in the latest version. Thanks a lot. Jorge Magalhães [-- Attachment #1.2: Type: text/html, Size: 500 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-24 7:44 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <8298719e-3e97-4525-ba6f-c168fef2788f@Spark> 2021-07-23 9:07 ` lmt_chart_bar with data from luacode Jorge Manuel 2021-07-23 15:58 ` Hans Hagen 2021-07-23 21:56 ` Jorge Manuel 2021-07-24 7:40 ` Floris van Manen 2021-07-24 7:44 ` Jorge Manuel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).