public static function factory($type, $properties)
    {
        switch ($type) {
            case 'evolution':
                return new JqplotDataGenerator\Evolution($properties, $type);
            case 'pie':
            case 'bar':
                return new JqplotDataGenerator($properties, $type);
            default:
                throw new Exception("Unknown JqplotDataGenerator type '$type'.");
        }
    }