{
    "content": [
        {
            "type": "text",
            "text": "# GD::Graph (perldoc)\n\n## NAME\n\nGD::Graph - Graph Plotting Module for Perl 5\n\n## SYNOPSIS\n\nuse GD::Graph::moduleName;\n\n## DESCRIPTION\n\nGD::Graph is a *perl5* module to create charts using the GD module. The following classes for\ngraphs with axes are defined:\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **DISTRIBUTION STATUS**\n- **EXAMPLES**\n- **USAGE**\n- **METHODS** (3 subsections)\n- **OPTIONS** (10 subsections)\n- **COLOURS**\n- **FONTS**\n- **HOTSPOTS**\n- **ERROR HANDLING**\n- **NOTES**\n- **BUGS**\n- **AUTHOR** (2 subsections)\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GD::Graph",
        "section": "",
        "mode": "perldoc",
        "summary": "GD::Graph - Graph Plotting Module for Perl 5",
        "synopsis": "use GD::Graph::moduleName;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "See the samples directory in the distribution, and read the Makefile there."
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "DISTRIBUTION STATUS",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "USAGE",
                "lines": 87,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Methods for all graphs",
                        "lines": 43
                    },
                    {
                        "name": "Methods for Pie charts",
                        "lines": 5
                    },
                    {
                        "name": "Methods for charts with axes.",
                        "lines": 21
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Options for all graphs",
                        "lines": 32
                    },
                    {
                        "name": "Colours",
                        "lines": 49
                    },
                    {
                        "name": "Options for graphs with axes.",
                        "lines": 231
                    },
                    {
                        "name": "Plotting data point values with the data point",
                        "lines": 40
                    },
                    {
                        "name": "Options for graphs with a numerical X axis",
                        "lines": 26
                    },
                    {
                        "name": "Options for graphs with bars",
                        "lines": 17
                    },
                    {
                        "name": "Options for graphs with lines",
                        "lines": 35
                    },
                    {
                        "name": "Options for graphs with points",
                        "lines": 15
                    },
                    {
                        "name": "Options for mixed graphs",
                        "lines": 53
                    },
                    {
                        "name": "Options for pie graphs",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "COLOURS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "FONTS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "HOTSPOTS",
                "lines": 45,
                "subsections": []
            },
            {
                "name": "ERROR HANDLING",
                "lines": 37,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 4,
                "subsections": [
                    {
                        "name": "Copyright",
                        "lines": 7
                    },
                    {
                        "name": "Acknowledgements",
                        "lines": 10
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "GD::Graph - Graph Plotting Module for Perl 5\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use GD::Graph::moduleName;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "GD::Graph is a *perl5* module to create charts using the GD module. The following classes for\ngraphs with axes are defined:\n\n\"GD::Graph::lines\"\nCreate a line chart.\n\n\"GD::Graph::bars\" and \"GD::Graph::hbars\"\nCreate a bar chart with vertical or horizontal bars.\n\n\"GD::Graph::points\"\nCreate an chart, displaying the data as points.\n\n\"GD::Graph::linespoints\"\nCombination of lines and points.\n\n\"GD::Graph::area\"\nCreate a graph, representing the data as areas under a line.\n\n\"GD::Graph::mixed\"\nCreate a mixed type graph, any combination of the above. At the moment this is fairly\nlimited. Some of the options that can be used with some of the individual graph types won't\nwork very well. Bar graphs drawn after lines or points graphs may obscure the earlier data,\nand specifying barwidth will not produce the results you probably expected.\n\nAdditional types:\n\n\"GD::Graph::pie\"\nCreate a pie chart.\n",
                "subsections": []
            },
            "DISTRIBUTION STATUS": {
                "content": "Distribution has no releases since 2007. It has new maintainer starting of 1.45 and my plan is\nto keep modules backwards compatible as much as possible, fix bugs with test cases, apply\npatches and release new versions to the CPAN.\n\nI got repository from Martien without Benjamin's work, Benjamin couldn't find his repository, so\neverything else is imported from CPAN and BackPAN. Now it's all on github\n<https://github.com/ruz/GDGraph>. May be at some point Benjamin will find his VCS backup and we\ncan restore full history.\n\nRelease 1.4401 (development release) was released in 2007 by Benjamin, but never made into\nproduction version. This dev version contains very nice changes (truecolor, anti-aliasing and\nalpha support), but due to nature of how GD and GD::Graph works authors had to add third\noptional argument (truecolor) to all constructors in GD::Graph modules. I think that this should\nbe and can be adjusted to receive named arguments in constructor and still be backwards\ncompatible. If you were using that dev release and want to fast forward inclusion of this work\ninto production release then contact ruz@cpan.org\n\nMartien also has changes in his repository that were never published to CPAN. These are smaller\nand well isolated, so I can merge them faster.\n\nMy goal at this moment is to merge existing versions together, get rid of CVS reminders, do some\nrepo cleanup, review existing tickets on rt.cpan.org. Join if you want to help.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "See the samples directory in the distribution, and read the Makefile there.\n",
                "subsections": []
            },
            "USAGE": {
                "content": "Fill an array of arrays with the x values and the values of the data sets. Make sure that every\narray is the same size, otherwise *GD::Graph* will complain and refuse to compile the graph.\n\n@data = (\n[\"1st\",\"2nd\",\"3rd\",\"4th\",\"5th\",\"6th\",\"7th\", \"8th\", \"9th\"],\n[    1,    2,    5,    6,    3,  1.5,    1,     3,     4],\n[ sort { $a <=> $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]\n);\n\nIf you don't have a value for a point in a certain dataset, you can use undef, and the point\nwill be skipped.\n\nCreate a new *GD::Graph* object by calling the *new* method on the graph type you want to create\n(*chart* is *bars*, *hbars*, *lines*, *points*, *linespoints*, *mixed* or *pie*).\n\nmy $graph = GD::Graph::chart->new(400, 300);\n\nSet the graph options.\n\n$graph->set(\nxlabel           => 'X Label',\nylabel           => 'Y label',\ntitle             => 'Some simple graph',\nymaxvalue       => 8,\nyticknumber     => 8,\nylabelskip      => 2\n) or die $graph->error;\n\nand plot the graph.\n\nmy $gd = $graph->plot(\\@data) or die $graph->error;\n\nThen do whatever your current version of GD allows you to do to save the file. For versions of\nGD older than 1.19 (or more recent than 2.15), you'd do something like:\n\nopen(IMG, '>file.gif') or die $!;\nbinmode IMG;\nprint IMG $gd->gif;\nclose IMG;\n\nand for newer versions (1.20 and up) you'd write\n\nopen(IMG, '>file.png') or die $!;\nbinmode IMG;\nprint IMG $gd->png;\n\nor\n\nopen(IMG, '>file.gd2') or die $!;\nbinmode IMG;\nprint IMG $gd->gd2;\n\nThen there's also of course the possibility of using a shorter version (for each of the export\nfunctions that GD supports):\n\nprint IMG $graph->plot(\\@data)->gif;\nprint IMG $graph->plot(\\@data)->png;\nprint IMG $graph->plot(\\@data)->gd;\nprint IMG $graph->plot(\\@data)->gd2;\n\nIf you want to write something that doesn't require your code to 'know' whether to use gif or\npng, you could do something like:\n\nif ($gd->can('png')) { # blabla }\n\nor you can use the convenience method \"exportformat\":\n\nmy $format = $graph->exportformat;\nopen(IMG, \">file.$format\") or die $!;\nbinmode IMG;\nprint IMG $graph->plot(\\@data)->$format();\nclose IMG;\n\nor for CGI programs:\n\nuse CGI qw(:standard);\n#...\nmy $format = $graph->exportformat;\nprint header(\"image/$format\");\nbinmode STDOUT;\nprint $graph->plot(\\@data)->$format();\n\n(the parentheses after $format are necessary, to help the compiler decide that you mean a method\nname there)\n\nSee under \"SEE ALSO\" for references to other documentation, especially the FAQ.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Methods for all graphs",
                        "content": "GD::Graph::chart->new([width,height])\nCreate a new object $graph with optional width and height. Default width = 400, default\nheight = 300. *chart* is either *bars*, *lines*, *points*, *linespoints*, *area*, *mixed* or\n*pie*.\n\n$graph->settextclr(*colour name*)\nSet the colour of the text. This will set the colour of the titles, labels, and axis labels\nto *colour name*. Also see the options *textclr*, *labelclr* and *axislabelclr*.\n\n$graph->settitlefont(font specification)\nSet the font that will be used for the title of the chart. See \"FONTS\".\n\n$graph->plot(*\\@data*)\nPlot the chart, and return the GD::Image object.\n\n$graph->set(attrib1 => value1, attrib2 => value2 ...)\nSet chart options. See OPTIONS section.\n\n$graph->get(attrib1, attrib2)\nReturns a list of the values of the attributes. In scalar context returns the value of the\nfirst attribute only.\n\n$graph->gd()\nGet the GD::Image object that is going to be used to draw on. You can do this either before\nor after calling the plot method, to do your own drawing.\n\nNote: as of the current version, this GD::Image object will always be palette-based, even if\nthe installed version of GD supports true-color images.\n\nNote also that if you draw on the GD::Image object before calling the plot method, you are\nresponsible for making sure that the background colour is correct and for setting\ntransparency.\n\n$graph->exportformat()\nQuery the export format of the GD library in use. In scalar context, it returns 'gif', 'png'\nor undefined, which is sufficient for most people's use. In a list context, it returns a\nlist of all the formats that are supported by the current version of GD. It can be called as\na class or object method\n\n$graph->candottf()\nReturns true if the current GD library supports TrueType fonts, False otherwise. Can also be\ncalled as a class method or static method.\n"
                    },
                    {
                        "name": "Methods for Pie charts",
                        "content": "$graph->setlabelfont(font specification)\n$graph->setvaluefont(font specification)\nSet the font that will be used for the label of the pie or the values on the pie. See\n\"FONTS\".\n"
                    },
                    {
                        "name": "Methods for charts with axes.",
                        "content": "$graph->setxlabelfont(font specification)\n$graph->setylabelfont(font specification)\n$graph->setxaxisfont(font specification)\n$graph->setyaxisfont(font specification)\n$graph->setvaluesfont(font specification)\nSet the font for the x and y axis label, the x and y axis value labels, and for the values\nprinted above the data points. See \"FONTS\".\n\n$graph->gethotspot($dataset, $point)\nExperimental: Return a coordinate specification for a point in a dataset. Returns a list. If\nthe point is not specified, returns a list of array references for all points in the\ndataset. If the dataset is also not specified, returns a list of array references for each\ndata set. See \"HOTSPOTS\".\n\n$graph->getfeaturecoordinates($featurename)\nExperimental: Return a coordinate specification for a certain feature in the chart.\nCurrently, features that are defined are *axes*, the coordinates of the rectangle within the\naxes; *xlabel*, *y1label* and *y2label*, the labels printed along the axes, with\n*ylabel* provided as an alias for *y1label*; and *title* which is the title text box. See\n\"HOTSPOTS\".\n"
                    }
                ]
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Options for all graphs",
                        "content": "width, height\nThe width and height of the canvas in pixels Default: 400 x 300. NB At the moment, these are\nread-only options. If you want to set the size of a graph, you will have to do that with the\n*new* method.\n\ntmargin, bmargin, lmargin, rmargin\nTop, bottom, left and right margin of the canvas. These margins will be left blank. Default:\n0 for all.\n\nlogo\nName of a logo file. Generally, this should be the same format as your version of GD exports\nimages in. Currently, this file may be in any format that GD can import, but please see GD\nif you use an XPM file and get unexpected results.\n\nDefault: no logo.\n\nlogoresize, logoposition\nFactor to resize the logo by, and the position on the canvas of the logo. Possible values\nfor logoposition are 'LL', 'LR', 'UL', and 'UR'. (lower and upper left and right). Default:\n'LR'.\n\ntransparent\nIf set to a true value, the produced image will have the background colour marked as\ntransparent (see also option *bgclr*). Default: 1.\n\ninterlaced\nIf set to a true value, the produced image will be interlaced. Default: 1.\n\nNote: versions of GD higher than 2.0 (that is, since GIF support was restored after being\nremoved owing to patent issues) do not support interlacing of GIF images. Support for\ninterlaced PNG and progressive JPEG images remains available using this option.\n"
                    },
                    {
                        "name": "Colours",
                        "content": "bgclr, fgclr, boxclr, accentclr, shadowclr\nDrawing colours used for the chart: background, foreground (axes and grid), axis box fill\ncolour, accents (bar, area and pie outlines), and shadow (currently only for bars).\n\nAll colours should have a valid value as described in \"COLOURS\", except boxclr, which can be\nundefined, in which case the box will not be filled.\n\nshadowdepth\nDepth of a shadow, positive for right/down shadow, negative for left/up shadow, 0 for no\nshadow (default). Also see the \"shadowclr\" and \"barspacing\" options.\n\nlabelclr, axislabelclr, legendclr, valuesclr, textclr\nText Colours used for the chart: label (labels for the axes or pie), axis label (misnomer:\nvalues printed along the axes, or on a pie slice), legend text, shown values text, and all\nother text.\n\nAll colours should have a valid value as described in \"COLOURS\".\n\ndclrs (short for datacolours)\nThis controls the colours for the bars, lines, markers, or pie slices. This should be a\nreference to an array of colour names as defined in GD::Graph::colour\n(\"perldoc GD::Graph::colour\" for the names available).\n\n$graph->set( dclrs => [ qw(green pink blue cyan) ] );\n\nThe first (fifth, ninth) data set will be green, the next pink, etc.\n\nA colour can be \"undef\", in which case the data set will not be drawn. This can be useful\nfor cumulative bar sets where you want certain data series (often the first one) not to show\nup, which can be used to emulate error bars (see examples 1-7 and 6-3 in the distribution).\n\nDefault: [ qw(lred lgreen lblue lyellow lpurple cyan lorange) ]\n\nborderclrs\nThis controls the colours of the borders of the bars data sets. Like dclrs, it is a\nreference to an array of colour names as defined in GD::Graph::colour. Setting a border\ncolour to \"undef\" means the border will not be drawn.\n\ncycleclrs\nIf set to a true value, bars will not have a colour from \"dclrs\" per dataset, but per point.\nThe colour sequence will be identical for each dataset. Note that this may have a weird\neffect if you are drawing more than one data set. If this is set to a value larger than 1\nthe border colour of the bars will cycle through the colours in \"borderclrs\".\n\naccenttreshold\nNot really a colour, but it does control a visual aspect: Accents on bars are only drawn\nwhen the width of a bar is larger than this number of pixels. Accents inside areas are only\ndrawn when the horizontal distance between points is larger than this number. Default 4\n"
                    },
                    {
                        "name": "Options for graphs with axes.",
                        "content": "options for *bars*, *lines*, *points*, *linespoints*, *mixed* and *area* charts.\n\nxlabel, ylabel\nThe labels to be printed next to, or just below, the axes. Note that if you use the twoaxes\noption that you need to use y1label and y2label.\n\nlongticks, ticklength\nIf *longticks* is a true value, ticks will be drawn the same length as the axes. Otherwise\nticks will be drawn with length *ticklength*. if *ticklength* is negative, the ticks will\nbe drawn outside the axes. Default: longticks = 0, ticklength = 4.\n\nThese attributes can also be set for x and y axes separately with xlongticks,\nylongticks, xticklength and yticklength.\n\nxticks\nIf *xticks* is a true value, ticks will be drawn for the x axis. These ticks are subject to\nthe values of *longticks* and *ticklength*. Default: 1.\n\nyticknumber\nNumber of ticks to print for the Y axis. Use this, together with *ylabelskip* to control\nthe look of ticks on the y axis. Default: 5.\n\nynumberformat\nThis can be either a string, or a reference to a subroutine. If it is a string, it will be\ntaken to be the first argument to a sprintf, with the value as the second argument:\n\n$label = sprintf( $s->{ynumberformat}, $value );\n\nIf it is a code reference, it will be executed with the value as the argument:\n\n$label = &{$s->{ynumberformat}}($value);\n\nThis can be useful, for example, if you want to reformat your values in currency, with the -\nsign in the right spot. Something like:\n\nsub yformat\n{\nmy $value = shift;\nmy $ret;\n\nif ($value >= 0)\n{\n$ret = sprintf(\"\\$%d\", $value * $refit);\n}\nelse\n{\n$ret = sprintf(\"-\\$%d\", abs($value) * $refit);\n}\n\nreturn $ret;\n}\n\n$graph->set( 'ynumberformat' => \\&yformat );\n\n(Yes, I know this can be much shorter and more concise)\n\nDefault: undef.\n\ny1numberformat, y2numberformat\nAs with *ynumberformat*, these can be either a string, or a reference to a subroutine.\nThese are used as formats for graphs with two y-axis scales so that independent formats can\nbe used.\n\nFor compatibility purposes, each of these will fall back on *ynumberformat* if not\nspecified.\n\nDefault: undef for both.\n\nxlabelskip, ylabelskip\nPrint every *xlabelskip*th number under the tick on the x axis, and every *ylabelskip*th\nnumber next to the tick on the y axis. Default: 1 for both.\n\nxlastlabelskip\nBy default, when *xlabelskip* is set to something higher than 1, the last label on the\naxis will be printed, even when it doesn't belong to the normal series that should be\nprinted. Setting this to a true value prevents that.\n\nFor example, when your X values are the months of the year (i.e. Jan - Dec), and you set\n*xlabelskip* to 3, the months printed on the axis will be Jan, Apr, Jul, Oct and Dec; even\nthough Dec does not really belong to that sequence. If you do not like the last month to be\nprinted, set *xlastlabelskip* to a true value.\n\nThis option has no effect in other circumstances. Also see *xtickoffset* for another\nmethod to make this look better. Default: 0 for both\n\nxtickoffset\nWhen *xlabelskip* is used, this will skip the first *xtickoffset* values in the labels\nbefore starting to print. Let me give an example. If you have a series of X labels like\n\nqw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)\n\nand you set *xlabelskip* to 3, you will see ticks on the X axis for Jan, Apr, Jul, Oct and\nDec. This is not always what is wanted. If you set *xtickoffset* to 1, you get Feb, May,\nAug, Nov and Dec, and if you set it to 2, you get Mar, Jun Sep and Dec, and this last one\ndefinitely looks better. A combination of 6 and 5 also works nice for months.\n\nNote that the value for *xtickoffset* is periodical. This means that it will have the same\neffect for each integer n in *xtickoffset* + n * *xlabelskip*.\n\nAlso see *xlastlabelskip* for another method to influence this.\n\nxallticks\nForce a print of all the x ticks, even if xlabelskip is set to a value Default: 0.\n\nxlabelposition\nControls the position of the X axis label (title). The value for this should be between 0\nand 1, where 0 means aligned to the left, 1 means aligned to the right, and 1/2 means\ncentered. Default: 3/4\n\nylabelposition\nControls the position of both Y axis labels (titles). The value for this should be between 0\nand 1, where 0 means aligned to the bottom, 1 means aligned to the top, and 1/2 means\ncentered. Default: 1/2\n\nxlabelsvertical\nIf set to a true value, the X axis labels will be printed vertically. This can be handy in\ncase these labels get very long. Default: 0.\n\nxplotvalues, yplotvalues\nIf set to a true value, the values of the ticks on the x or y axes will be plotted next to\nthe tick. Also see *xlabelskip, ylabelskip*. Default: 1 for both.\n\nboxaxis\nDraw the axes as a box, if true. Default: 1.\n\nnoaxes\nDraw no axes at all. If this is set to undef, all axes are drawn. If it is set to 0, the\nzero axis will be drawn, *for bar charts only*. If this is set to a true value, no axes will\nbe drawn at all. Value labels on the axes and ticks will also not be drawn, but axis lables\nare drawn. Default: undef.\n\ntwoaxes\nUse two separate axes for the first and second data set. The first data set will be set\nagainst the left axis, the second against the right axis. If more than two data sets are\nbeing plotted, the useaxis option should be used to specify which data sets use which axis.\n\nNote that if you use this option, that you need to use y1label and y2label, instead of\njust ylabel, if you want the two axes to have different labels. The same goes for some\nother options starting with the letter 'y' and an underscore.\n\nDefault: 0.\n\nuseaxis\nIf two y-axes are in use and more than two datasets are specified, set this option to an\narray reference containing a value of 1 or 2 (for the left and right scales respectively)\nfor each dataset being plotted. That is, to plot three datasets with the second on a\ndifferent scale than the first and third, set this to \"[1,2,1]\".\n\nDefault: [1,2].\n\nzeroaxis\nIf set to a true value, the axis for y values of 0 will always be drawn. This might be\nuseful in case your graph contains negative values, but you want it to be clear where the\nzero value is. (see also *zeroaxisonly* and *boxaxes*). Default: 0.\n\nzeroaxisonly\nIf set to a true value, the zero axis will be drawn (see *zeroaxis*), and no axis at the\nbottom of the graph will be drawn. The labels for X values will be placed on the zero axis.\nDefault: 0.\n\nymaxvalue, yminvalue\nMaximum and minimum value displayed on the y axis.\n\nThe range (yminvalue..ymaxvalue) has to include all the values of the data points, or\n*GD::Graph* will die with a message.\n\nFor bar and area graphs, the range (yminvalue..ymaxvalue) has to include 0. If it\ndoesn't, the values will be adapted before attempting to draw the graph.\n\nDefault: Computed from data sets.\n\ny1maxvalue, y1minvalue, y2maxvalue, y2minvalue\nMaximum and minimum values for left (y1) and right (y2) axes when twoaxes is a true value.\nTake precedence over yminvalue and ymaxvalue.\n\nBy default 0 of the left axis is aligned with 0 of the right axis, it's not true if any of\nthese options is defined.\n\nOtherwise behaviour and default values are as with ymaxvalue and yminvalue.\n\nyminrange, y1minrange, y2minrange\nMinimal range between min and max values on y axis that is used to adjust computed\nyminvalue and ymaxvalue.\n\nNOTE that author of the feature implemented this for twoaxes case only, patches are\nwellcome to expand over one y axis.\n\nIf twoaxes is a true value, then y1minrange and y2minrange take precedence over\nyminrange value.\n\nDefault: undef\n\naxisspace\nThis space will be left blank between the axes and the tick value text. Default: 4.\n\ntextspace\nThis space will be left open between text elements and the graph (text elements are title\nand axis labels.\n\nDefault: 8.\n\ncumulate\nIf this attribute is set to a true value, the data sets will be cumulated. This means that\nthey will be stacked on top of each other. A side effect of this is that \"overwrite\" will be\nset to a true value.\n\nNotes: This only works for bar and area charts at the moment.\n\nIf you have negative values in your data sets, setting this option might produce odd\nresults. Of course, the graph itself would be quite meaningless.\n\noverwrite\nIf set to 0, bars of different data sets will be drawn next to each other. If set to 1, they\nwill be drawn in front of each other. Default: 0.\n\nNote: Setting overwrite to 2 to produce cumulative sets is deprecated, and may disappear in\nfuture versions of GD::Graph. Instead see the \"cumulate\" attribute.\n\ncorrectwidth\nIf this is set to a true value and \"xticknumber\" is false, then the width of the graph (or\nthe height for rotated graphs like \"GD::Graph::hbar\") will be recalculated to make sure that\neach data point is exactly an integer number of pixels wide. You probably never want to\nfiddle with this.\n\nWhen this value is true, you will need to make sure that the number of data points is\nsmaller than the number of pixels in the plotting area of the chart. If you get errors\nsaying that your horizontal size if too small, you may need to manually switch this off, or\nconsider using something else than a bar type for your chart.\n\nDefault: 1 for bar, calculated at runtime for mixed charts, 0 for others.\n"
                    },
                    {
                        "name": "Plotting data point values with the data point",
                        "content": "Sometimes you will want to plot the value of a data point or bar above the data point for\nclarity. GD::Graph allows you to control this in a generic manner, or even down to the single\npoint.\n\nshowvalues\nSet this to 1 to display the value of each data point above the point or bar itself. No\neffort is being made to ensure that there is enough space for the text.\n\nSet this to a GD::Graph::Data object, or an array reference of the same shape, with the same\ndimensions as your data object that you pass in to the plot method. The reason for this\noption is that it allows you to make a copy of your data set, and selectively set points to\n\"undef\" to disable plotting of them.\n\nmy $data = GD::Graph::Data->new(\n[ [ 'A', 'B', 'C' ], [ 1, 2, 3 ], [ 11, 12, 13 ] ]);\nmy $values = $data->copy;\n$values->sety(1, 1, undef);\n$values->sety(2, 0, undef);\n\n$graph->set(showvalues => $values);\n$graph->plot($data);\n\nDefault: 0.\n\nvaluesvertical\nIf set to a true value, the values will be printed vertically, instead of horizontally. This\ncan be handy if the values are long numbers. Default: 0.\n\nvaluesspace\nSpace to insert between the data point and the value to print. Default: 4.\n\nvaluesformat\nHow to format the values for display. See ynumberformat for more information. Default:\nundef.\n\nhideoverlappingvalues\nIf set to a true value, the values that goes out of graph space are hidden. Option is\nEXPERIMENTAL, works only for bars, text still can overlap with other bars and labels, most\nuseful only with text in the same direction as bars. Default: undef\n"
                    },
                    {
                        "name": "Options for graphs with a numerical X axis",
                        "content": "First of all: GD::Graph does not support numerical x axis the way it should. Data for X axes\nshould be equally spaced. That understood: There is some support to make the printing of graphs\nwith numerical X axis values a bit better, thanks to Scott Prahl. If the option \"xticknumber\"\nis set to a defined value, GD::Graph will attempt to treat the X data as numerical.\n\nExtra options are:\n\nxticknumber\nIf set to *'auto'*, GD::Graph will attempt to format the X axis in a nice way, based on the\nactual X values. If set to a number, that's the number of ticks you will get. If set to\nundef, GD::Graph will treat X data as labels. Default: undef.\n\nxminvalue, xmaxvalue\nThe minimum and maximum value to use for the X axis. Default: computed.\n\nxminrange\nMinimal range of x axis.\n\nDefault: undef\n\nxnumberformat\nSee ynumberformat\n\nxlabelskip\nSee ylabelskip\n"
                    },
                    {
                        "name": "Options for graphs with bars",
                        "content": "barwidth\nThe width of a bar in pixels. Also see \"barspacing\". Use \"barwidth\" If you want to have\nfixed-width bars, no matter how wide the chart gets. Default: as wide as possible, within\nthe constraints of the chart size and \"barspacing\" setting.\n\nbarspacing\nNumber of pixels to leave open between bars. This works well in most cases, but on some\nplatforms, a value of 1 will be rounded off to 0. Use \"barspacing\" to get a fixed amount of\nspace between bars, with variable bar widths, depending on the width of the chart. Note that\nif \"barwidth\" is also set, this setting will be ignored, and automatically calculated.\nDefault: 0\n\nbargroupspacing\nNumber of pixels (in addition to whatever is specified in \"barspacing\") to leave between\ngroups of bars when multiple datasets are being displayed. Unlike \"barspacing\", however,\nthis parameter will hold its value if \"barwidth\" is set.\n"
                    },
                    {
                        "name": "Options for graphs with lines",
                        "content": "linetypes\nWhich line types to use for *lines* and *linespoints* graphs. This should be a reference to\nan array of numbers:\n\n$graph->set( linetypes => [3, 2, 4] );\n\nAvailable line types are 1: solid, 2: dashed, 3: dotted, 4: dot-dashed.\n\nDefault: [1] (always use solid)\n\nlinetypescale\nControls the length of the dashes in the line types. default: 6.\n\nlinewidth\nThe width of the line used in *lines* and *linespoints* graphs, in pixels. Default: 1.\n\nskipundef\nFor all other axes graph types, the default behaviour is (by their nature) to not draw a\npoint when the Y value is \"undef\". For line charts the point gets skipped as well, but the\nline is drawn between the points n-1 to n+1 directly. If \"skipundef\" has a true value,\nthere will be a gap in the chart where a Y value is undefined.\n\nNote that a line will not be drawn unless there are *at least two* consecutive data points\nexist that have a defined value. The following data set will only plot a very short line\ntowards the end if \"skipundef\" is set:\n\n@data = (\n[ qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct ) ],\n[ 1, undef, 2, undef, 3, undef, 4, undef, 5, 6 ]\n);\n\nThis option is useful when you have a consecutive gap in your data, or with linespoints\ncharts. If you have data where you have intermittent gaps, be careful when you use this.\nDefault value: 0\n"
                    },
                    {
                        "name": "Options for graphs with points",
                        "content": "markers\nThis controls the order of markers in *points* and *linespoints* graphs. This should be a\nreference to an array of numbers:\n\n$graph->set( markers => [3, 5, 6] );\n\nAvailable markers are: 1: filled square, 2: open square, 3: horizontal cross, 4: diagonal\ncross, 5: filled diamond, 6: open diamond, 7: filled circle, 8: open circle, 9: horizontal\nline, 10: vertical line. Note that the last two are not part of the default list.\n\nDefault: [1,2,3,4,5,6,7,8]\n\nmarkersize\nThe size of the markers used in *points* and *linespoints* graphs, in pixels. Default: 4.\n"
                    },
                    {
                        "name": "Options for mixed graphs",
                        "content": "types\nA reference to an array with graph types, in the same order as the data sets. Possible\nvalues are:\n\n$graph->set( types => [qw(lines bars points area linespoints)] );\n$graph->set( types => ['lines', undef, undef, 'bars'] );\n\nvalues that are undefined or unknown will be set to \"defaulttype\".\n\nDefault: all set to \"defaulttype\"\n\ndefaulttype\nThe type of graph to draw for data sets that either have no type set, or that have an\nunknown type set.\n\nDefault: lines\n\nGraph legends (axestype graphs only)\nAt the moment legend support is minimal.\n\nMethods\n\n$graph->setlegend(*@legendkeys*);\nSets the keys for the legend. The elements of @legendkeys correspond to the data sets as\nprovided to *plot()*.\n\nIf a key is *undef* or an empty string, the legend entry will be skipped.\n\n$graph->setlegendfont(*font name*);\nSets the font for the legend text (see \"FONTS\"). Default: GD::gdTinyFont.\n\nOptions\n\nlegendplacement\nWhere to put the legend. This should be a two letter key of the form: 'B[LCR]|R[TCB]'. The\nfirst letter indicates the placement (*B*ottom or *R*ight), and the second letter the\nalignment (*L*eft, *R*ight, *C*enter, *T*op, or *B*ottom). Default: 'BC'\n\nIf the legend is placed at the bottom, some calculations will be made to ensure that there\nis some 'intelligent' wrapping going on. if the legend is placed at the right, all entries\nwill be placed below each other.\n\nlegendspacing\nThe number of pixels to place around a legend item, and between a legend 'marker' and the\ntext. Default: 4\n\nlegendmarkerwidth, legendmarkerheight\nThe width and height of a legend 'marker' in pixels. Defaults: 12, 8\n\nlgcols\nIf you, for some reason, need to force the legend at the bottom to have a specific number of\ncolumns, you can use this. Default: computed\n"
                    },
                    {
                        "name": "Options for pie graphs",
                        "content": "3d  If set to a true value, the pie chart will be drawn with a 3d look. Default: 1.\n\npieheight\nThe thickness of the pie when *3d* is true. Default: 0.1 x height.\n\nstartangle\nThe angle at which the first data slice will be displayed, with 0 degrees being \"6 o'clock\".\nDefault: 0.\n\nsuppressangle\nIf a pie slice is smaller than this angle (in degrees), a label will not be drawn on it.\nDefault: 0.\n\nlabel\nPrint this label below the pie. Default: undef.\n"
                    }
                ]
            },
            "COLOURS": {
                "content": "All references to colours in the options for this module have been shortened to clr. The main\nreason for this was that I didn't want to support two spellings for the same word ('colour' and\n'color')\n\nWherever a colour is required, a colour name should be used from the package GD::Graph::colour.\n\"perldoc GD::Graph::colour\" should give you the documentation for that module, containing all\nvalid colour names. I will probably change this to read the systems rgb.txt file if it is\navailable.\n",
                "subsections": []
            },
            "FONTS": {
                "content": "Depending on your version of GD, this accepts both GD builtin fonts or the name of a TrueType\nfont file. In the case of a TrueType font, you must specify the font size. See GD::Text for more\ndetails and other things, since all font handling in GD::Graph is delegated to there.\n\nExamples:\n\n$graph->settitlefont('/fonts/arial.ttf', 18);\n$graph->setlegendfont(gdTinyFont);\n$graph->setlegendfont(\n['verdana', 'arial', gdMediumBoldFont], 12)\n\n(The above discussion is based on GD::Text 0.65. Older versions have more restrictive\nbehaviour).\n",
                "subsections": []
            },
            "HOTSPOTS": {
                "content": "*Note that this is an experimental feature, and its interface may, and likely will, change in\nthe future. It currently does not work for area charts or pie charts.*\n\n*A known problem with hotspots for GD::Graph::hbars is that the x and y coordinate come out\ntransposed. This probably won't be fixed until the redesign of this section*\n\nGD::Graph keeps an internal set of coordinates for each data point and for certain features of a\nchart, like the title and axis labels. This specification is very similar to the HTML image map\nspecification, and in fact exists mainly for that purpose. You can get at these hotspots with\nthe \"gethotspot\" method for data point, and \"getfeaturecoordinates\" for the chart features.\n\nThe <gethotspot> method accepts two optional arguments, the number of the dataset you're\ninterested in, and the number of the point in that dataset you're interested in. When called\nwith two arguments, the method returns a list of one of the following forms:\n\n'rect', x1, y1, x2, y2\n'poly', x1, y1, x2, y2, x3, y3, ....\n'line', xs, ys, xe, ye, width\n\nThe parameters for \"rect\" are the coordinates of the corners of the rectangle, the parameters\nfor \"poly\" are the coordinates of the vertices of the polygon, and the parameters for the \"line\"\nare the coordinates for the start and end point, and the line width. It should be possible to\nalmost directly translate these lists into HTML image map specifications.\n\nIf the second argument to \"gethotspot\" is omitted, a list of references to arrays will be\nreturned. This list represents all the points in the dataset specified, and each array referred\nto is of the form outlined above.\n\n['rect', x1, y1, x2, y2 ], ['rect', x1, y1, x2, y2], ...\n\nif both arguments to \"gethotspot\" are omitted, the list that comes back will contain references\nto arrays for each data set, which in turn contain references to arrays for each point.\n\n[\n['rect', x1, y1, x2, y2 ], ['rect', x1, y1, x2, y2], ...\n],\n[\n['line', xs, ys, xe, ye, w], ['line', xs, ys, xe, ye, w], ...\n],...\n\nThe \"getfeature\" method, when called with the name of a feature, returns a single array\nreference with a type and coordinates as described above. When called with no arguments, a hash\nreference is returned with the keys being all the currently defined and set features, and the\nvalues array references with the type and coordinates for each of those features.\n",
                "subsections": []
            },
            "ERROR HANDLING": {
                "content": "GD::Graph objects inherit from the GD::Graph::Error class (not the other way around), so they\nbehave in the same manner. The main feature of that behaviour is that you have the error()\nmethod available to get some information about what went wrong. The GD::Graph methods all return\nundef if something went wrong, so you should be able to write safe programs like this:\n\nmy $graph = GD::Graph->new()    or die GD::Graph->error;\n$graph->set( %attributes )      or die $graph->error;\n$graph->plot($gdgdata)         or die $graph->error;\n\nMore advanced usage is possible, and there are some caveats with this error handling, which are\nall explained in GD::Graph::Error.\n\nUnfortunately, it is almost impossible to gracefully recover from an error in GD::Graph, so you\nreally should get rid of the object, and recreate it from scratch if you want to recover. For\nexample, to adjust the correctwidth attribute if you get the error \"Horizontal size too small\"\nor \"Vertical size too small\" (in the case of hbar), you could do something like:\n\nsub plotgraph\n{\nmy $data    = shift;\nmy %attribs = @;\nmy $graph   = GD::Graph::bars->new()\nor die GD::Graph->error;\n$graph->set(%attribs)     or die $graph->error;\n$graph->plot($data)       or die $graph->error;\n}\n\nmy $gd;\neval { $gd = plotgraph(\\@data, %attribs) };\nif ($@)\n{\ndie $@ unless $@ =~ /size too small/;\n$gd = plotgraph(\\@data, %attribs, correctwidth => 0);\n}\n\nOf course, you could also adjust the width this way, and you can check for other errors.\n",
                "subsections": []
            },
            "NOTES": {
                "content": "As with all Modules for Perl: Please stick to using the interface. If you try to fiddle too much\nwith knowledge of the internals of this module, you could get burned. I may change them at any\ntime.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "GD::Graph objects cannot be reused. To create a new plot, you have to create a new GD::Graph\nobject.\n\nRotated charts (ones with the X axis on the left) can currently only be created for bars. With a\nlittle work, this will work for all others as well. Please, be patient :)\n\nOther outstanding bugs can (alas) probably be found in the RT queue for this distribution, at\nhttp://rt.cpan.org/Public/Dist/Display.html?Name=GDGraph\n\nIf you think you have found a bug, please check first to see if it has already been reported. If\nit has not, please do (you can use the web interface above or send e-mail to\n<bug-GDGraph@rt.cpan.org>). Bug reports should contain as many as possible of the following:\n\n*   a concise description of the buggy behavior and how it differs from what you expected,\n\n*   the versions of Perl, GD::Graph and GD that you are using,\n\n*   a short demonstration script that shows the bug in action,\n\n*   a patch that fixes it. :-)\n\nOf all of these, the third is probably the single most important, since producing a test case\ngenerally makes the explanation much more concise and understandable, as well as making it much\nsimpler to show that the bug has been fixed. As an incidental benefit, if the bug is in fact\ncaused by some code outside of GD::Graph, it will become apparent while you are writing the test\ncase, thereby saving time and confusion for all concerned.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Martien Verbruggen <mgjv@tradingpost.com.au>\n\nCurrent maintenance (including this release) by Benjamin Warfield <bwarfield@cpan.org>\n",
                "subsections": [
                    {
                        "name": "Copyright",
                        "content": "GIFgraph: Copyright (c) 1995-1999 Martien Verbruggen.\nChart::PNGgraph: Copyright (c) 1999 Steve Bonds.\nGD::Graph: Copyright (c) 1999 Martien Verbruggen.\n\nAll rights reserved. This package is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n"
                    },
                    {
                        "name": "Acknowledgements",
                        "content": "Thanks to Steve Bonds for releasing Chart::PNGgraph, and keeping the code alive when GD reached\nversion 1.20, and I didn't have time to do something about it.\n\nThanks to the following people for contributing code, or sending me fixes: Dave Belcher, Steve\nBonds, Mike Bremford, Damon Brodie, Gary Deschaines, brian d foy, Edwin Hildebrand, Ari Jolma,\nTim Meadowcroft, Honza Pazdziora, Scott Prahl, Ben Tilly, Vegard Vesterheim, Jeremy Wadsack.\n\nAnd some people whose real name I don't know, and whose email address I'd rather not publicise\nwithout their consent.\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "GD::Graph::FAQ, GD::Graph::Data, GD::Graph::Error, GD::Graph::colour\n",
                "subsections": []
            }
        }
    }
}