ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Handling of negative values in the statistical-charts?
@ 2021-08-21  7:23 Ramkumar KB via ntg-context
  2021-08-29  2:17 ` Ramkumar KB via ntg-context
  0 siblings, 1 reply; 2+ messages in thread
From: Ramkumar KB via ntg-context @ 2021-08-21  7:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Ramkumar KB


[-- Attachment #1.1: Type: text/plain, Size: 770 bytes --]

Dear List,

I have been exploring the use of the awesome statistical-charts
<https://akela.mendelu.cz/~thala/statcharts/> module. So first of all, a
big thanks to the authors of the same.

I seem to have hit a snag when it comes to handling of -ve values. In my
example (attached tex & pdf), the y-axis labels and the grids do not seem
to be working on the -ve side (also, able to flip labels above x-axis for
-ve values). This seems to be the case of column charts and bar charts (and
I will test this for the other types of charts also).

If this is a more generic issue across all the types, then I can contribute
towards enhancing it (as any charts module should handle -ve values). Any
tips or pointers would be really helpful.

Thank you very much.

best regards,

[-- Attachment #1.2: Type: text/html, Size: 966 bytes --]

[-- Attachment #2: columnchart_with_negative.pdf --]
[-- Type: application/pdf, Size: 10133 bytes --]

[-- Attachment #3: columnchart_with_negative.tex --]
[-- Type: application/octet-stream, Size: 926 bytes --]

\definepapersize[a4-portrait][A4][A4]
\setupcolors[state=start] % otherwise you get greyscale
\usecolors[crayola]
% for charts and graphs
\usemodule[statistical-charts]
% Setup the section headers
\setuphead[section,chapter,subject][color=black]
\setuphead[section,subject][style={\bf},  before={}, after={}]
\setuppapersize[a4-portrait]
\setuppagenumber[state=stop]
% define layouts
\setuplayout[topspace=10mm,
backspace=15mm,
header=50pt,footer=50pt,
textwidth=165mm,
height=middle,width=middle]

% =============== DOC STARTS HERE ===============
\starttext
\def\unemploydataone{20,17.2,-14.2,29.3,22.5,-18.4}
\def\agelabels{15--24,25--29,30--34,35--44,45--54,55+}

\columnchart[basic]
[xscale=1.1, yscale=0.25,yshift=-6.0,
left=0.5, distance=0.75,
columncolor=tamarange,columntransparency=0.7,
axesunits=yes,xunit=Age, yunit=Number ofunemployed persons (thousands)]
[data={\unemploydataone},xlabels={\agelabels}]

\stoptext

[-- Attachment #4: 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] 2+ messages in thread

* Re: Handling of negative values in the statistical-charts?
  2021-08-21  7:23 Handling of negative values in the statistical-charts? Ramkumar KB via ntg-context
@ 2021-08-29  2:17 ` Ramkumar KB via ntg-context
  0 siblings, 0 replies; 2+ messages in thread
From: Ramkumar KB via ntg-context @ 2021-08-29  2:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Ramkumar KB


[-- Attachment #1.1: Type: text/plain, Size: 1990 bytes --]

Hi,

I have added an 'advanced' type for line & bar graphs to handle the use
case for -ve y-values / 4th quadrant graphs. It works similar to 'basic'
but works for -ve y-values (i.e. for the 4th quadrant).

PFA the amended lua file (zip file) and sample of line graph.

\def\edudataone{-10,35.55,-20.0,33,31,-25,-32}
\def\yearlabelstwo{2013,2014,2015,2016,
2017}

\linechart[basic][
ylength=5,
xscale=1.6, yscale=0.1,
left=0.5,
distance=1.2,
linecolor=limegreen, linewidth=1.5,
dotscolor=islamicgreen,
dotswidth=8, dotslabels=yes,
axesunits=yes,
xunit=Year,
yunit=Number of graduates
(thousands)][
data={\edudataone},
xlabels={\yearlabelstwo}]

\linechart[advanced][
ylength=5,
xscale=1.6, yscale=0.1,
left=0.5,
distance=1.2,
linecolor=limegreen, linewidth=1.5,
dotscolor=islamicgreen,
dotswidth=8, dotslabels=yes,
axesunits=yes,
xunit=Year,
yunit=Number of graduates
(thousands)][
data={\edudataone},
xlabels={\yearlabelstwo}]

It will be fantastic to get some feedback on this from the original authors
and also next steps to add this across all the relevant charts.

Thank you,

best regards,
Ramkumar

On Sat, Aug 21, 2021 at 3:23 PM Ramkumar KB <ramkumarkb@gmail.com> wrote:

> Dear List,
>
> I have been exploring the use of the awesome statistical-charts
> <https://akela.mendelu.cz/~thala/statcharts/> module. So first of all, a
> big thanks to the authors of the same.
>
> I seem to have hit a snag when it comes to handling of -ve values. In my
> example (attached tex & pdf), the y-axis labels and the grids do not seem
> to be working on the -ve side (also, able to flip labels above x-axis for
> -ve values). This seems to be the case of column charts and bar charts (and
> I will test this for the other types of charts also).
>
> If this is a more generic issue across all the types, then I can
> contribute towards enhancing it (as any charts module should handle -ve
> values). Any tips or pointers would be really helpful.
>
> Thank you very much.
>
> best regards,
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 4603 bytes --]

[-- Attachment #2: fourth_quadrant.pdf --]
[-- Type: application/pdf, Size: 10579 bytes --]

[-- Attachment #3: t-statistical-charts.lua.zip --]
[-- Type: application/zip, Size: 13994 bytes --]

[-- Attachment #4: 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] 2+ messages in thread

end of thread, other threads:[~2021-08-29  2:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21  7:23 Handling of negative values in the statistical-charts? Ramkumar KB via ntg-context
2021-08-29  2:17 ` Ramkumar KB via ntg-context

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).