[Graph-dev] arbitrary number of data series
Adam Pirkle
adam at pirkle.org
Fri Jan 2 10:12:23 PST 2004
If you take a look in Gnuplot.pm, that error message would be generated by
if (ref($user_data_options_ref) ne "HASH") {
carp "Data options must be a hash.";
return 0;
}
(where $user_data_options_ref is equal to your $options)
So, something must have gone wrong when you created your options hash ref.
-Adam
On Fri, Jan 02, 2004 at 12:58:35PM +0000, Ollie Cook said the following:
> Hi,
>
> I am having some trouble using Chart::Graph::Gnuplot when wanting to plot
> a variable number of data series on the same graph.
>
> Based on various configuration options, data is retrieved from an SQL database.
> This data is massaged into an array of 'data set elements'
> ([\%data_set_options, \@matrix]), each element representing a data series.
>
> The number of data series depends on the number of columns returned by the SQL
> query.
>
> The following example shows the contents of this array, with three series each
> containing two data points (for demonstration purposes):
>
> $VAR1 = [
> [
> {
> 'type' => 'matrix',
> 'title' => 'Total'
> },
> [
> '2003-02-19',
> 100852
> ],
> [
> '2003-02-20',
> 528988
> ]
> ],
> [
> {
> 'type' => 'matrix',
> 'title' => 'External SMTP'
> },
> [
> '2003-02-19',
> 89759
> ],
> [
> '2003-02-20',
> 465174
> ]
> ],
> [
> {
> 'type' => 'matrix',
> 'title' => 'Internal Reinjections'
> },
> [
> '2003-02-19',
> 11093
> ],
> [
> '2003-02-20',
> 63814
> ]
> ]
> ];
>
> I was then hoping to be able to call gnuplot like:
>
> gnuplot($options, $all_series);
>
> where $options is a hashref and $options is an arrayref to the prepared array.
>
> However, gnuplot reports the following error when used like that:
>
> "Data options must be a hash."
>
> I am guessing this is caused by me passing an arrayref of 'data set elements'
> rather than a list of 'data set elements'. Is that correct?
>
> In any case, I've been unable to find any examples of using
> Chart::Graph::Gnuplot with arbitrary numbers of data series. If someone could
> point me in the correct direction that would be great.
>
> Thanks,
>
> Ollie
>
> --
> Oliver Cook Systems Administrator, Claranet UK
> ollie at uk.clara.net 020 7903 3065
> _______________________________________________
> Graph-dev mailing list
> Graph-dev at caida.org
> http://login.caida.org/mailman/listinfo/graph-dev
More information about the Graph-dev
mailing list