public function convert(array $data, $orientation = 'vertical', $datetime = false)
    {
        $chartData = array();

        // if only one series passed in (single-dimensional array), wrap in array for the series looping
        if (!$this->hasMultipleSeries($data)) {
            $data = array($data);
        }

        // loop through each series and convert its data
        foreach ($data as $series)
        {
            $seriesData = array();

            // convert each key/value pair in the series
            foreach ($series as $key => $value)
            {
                // if a date-time chart, convert keys that are either a datetime string or unix timestamp
                if ($datetime)
                {
                    // convert to unix timestamp if passed in a string datetime
                    $unixTimestamp = (is_string($key)) ? strtotime($key) : $key;

                    // flot takes data in milliseconds, so multiply the timestamp by 1000
                    $key = $unixTimestamp * 1000;
                }

                // pass in as (x, y) or (y, x) coordinates depending on of vertical or horizontal orientation
                $seriesData[] = ($orientation == 'vertical') ? array($key, $value) : array($value, $key);
            }

            $chartData[] = array('data' => $seriesData);
        }

        return json_encode($chartData);
    }