GogAxisColorMap

## GogAxisColorMap GogAxisColorMap — map values to colors. |

## Functions

GogAxisColorMap * | gog_axis_color_map_edit ()
void | (*GogAxisColorMapHandler) ()
gboolean | gog_axis_color_map_delete ()
GogAxisColorMap * | gog_axis_color_map_dup ()
void | gog_axis_color_map_foreach ()
GogAxisColorMap * | gog_axis_color_map_from_colors ()
GOColor | gog_axis_color_map_get_color ()
GogAxisColorMap const * | gog_axis_color_map_get_from_id ()
unsigned | gog_axis_color_map_get_max ()
char const * | gog_axis_color_map_get_id ()
char const * | gog_axis_color_map_get_name ()
GoResourceType | gog_axis_color_map_get_resource_type ()
GdkPixbuf * | gog_axis_color_map_get_snapshot ()
void | gog_axis_color_map_to_cairo ()

## Properties

GoResourceType | resource-type | Read / Write / Construct Only

## Types and Values

| GogAxisColorMap

## Object Hierarchy

        GObject
        ╰── GogAxisColorMap

## Implemented Interfaces

GogAxisColorMap implements GOPersist.

## Description

Used to map color and pseudo-3d axes values to the actual color. The first color maps 0 and the last a positive integer returned by `gog_axis_color_map_get_max()`. For color axes, these integer values must themselves be mapped to the minimum and maximum of the axis (unless the axis is inverted). For pseudo-3d axes, successive colors are obtained for integer values, cycling to the first color when the colors number is not large enough.

## Functions

### gog_axis_color_map_edit ()

    GogAxisColorMap *
    gog_axis_color_map_edit (GogAxisColorMap *map,
                             GOCmdContext *cc);

Opens a dialog to edit the color map. If `map` is `NULL`, creates a new one unless the user cancels the edition.

#### Parameters

map | a GogAxisColorMap or `NULL` |
cc | a GOCmdContext or `NULL` |

#### Returns

the edited color map.

[transfer none]

### GogAxisColorMapHandler ()

    void
    (*GogAxisColorMapHandler) (GogAxisColorMap const *map,
                               gpointer user_data);

Type of the callback to pass to `gog_axis_color_map_foreach()` to iterate through color maps.

#### Parameters

map | a GogAxisColorMap |
user_data | user data |

### gog_axis_color_map_delete ()

    gboolean
    gog_axis_color_map_delete (GogAxisColorMap *map);

Destroys the color map and remove it from the user directory and from the database.

#### Parameters

map | a GogAxisColorMap |

#### Returns

`TRUE` on success.

### gog_axis_color_map_dup ()

    GogAxisColorMap *
    gog_axis_color_map_dup (GogAxisColorMap const *map);

Duplicates the color map.

#### Parameters

map | a GogAxisColorMap |

#### Returns

the new color map.

[transfer full]

### gog_axis_color_map_foreach ()

    void
    gog_axis_color_map_foreach (GogAxisColorMapHandler handler,
                                gpointer user_data);

Executes `handler` to each color map installed on the system or loaded from a document.

#### Parameters

handler | a GogAxisColorMapHandler. | [scope call]
user_data | data to pass to `handler` |

### gog_axis_color_map_from_colors ()

    GogAxisColorMap *
    gog_axis_color_map_from_colors (char const *name,
                                    unsigned  nb,
                                    GOColor const *colors,
                                    GoResourceType type);

Creates a color map using `colors` .

#### Parameters

name | color map name |
nb | colors number |
colors | the colors |
type | the resource type |

#### Returns

the newly created color map.

[transfer full]

### gog_axis_color_map_get_color ()

    GOColor
    gog_axis_color_map_get_color (GogAxisColorMap const *map,
                                  double x);

Maps `x` to a color.

#### Parameters

map | a GogAxisMap |
x | the value to map |

#### Returns

the found color.

### gog_axis_color_map_get_from_id ()

    GogAxisColorMap const *
    gog_axis_color_map_get_from_id (char const *id);

Retrieves the color map whose identifier is `id` .

#### Parameters

id | the color map identifier to search for |

#### Returns

the found color map.

[transfer none]

### gog_axis_color_map_get_max ()

    unsigned
    gog_axis_color_map_get_max (GogAxisColorMap const *map);

Retrieves the value corresponding to the last color in the map. The first always corresponds to 0.

#### Parameters

map | a GogAxisMap |

#### Returns

the maximum value.

### gog_axis_color_map_get_id ()

    char const *
    gog_axis_color_map_get_id (GogAxisColorMap const *map);

Retrieves the color map name.

#### Parameters

map | a GogAxisMap |

#### Returns

the map name.

[transfer none]

### gog_axis_color_map_get_name ()

    char const *
    gog_axis_color_map_get_name (GogAxisColorMap const *map);

Retrieves the color map localized name.

#### Parameters

map | a GogAxisMap |

#### Returns

the map name.

[transfer none]

### gog_axis_color_map_get_resource_type ()

    GoResourceType
    gog_axis_color_map_get_resource_type (GogAxisColorMap const *map);

Retrieves the resource type for `map` .

#### Parameters

map | a GogAxisMap |

#### Returns

the resource type.

### gog_axis_color_map_get_snapshot ()

    GdkPixbuf *
    gog_axis_color_map_get_snapshot (GogAxisColorMap const *map,
                                     gboolean discrete,
                                     gboolean horizontal,
                                     unsigned  width,
                                     unsigned  height);

Builds a snapshot of the color map.

#### Parameters

map | a GogAxisMap |
discrete | whether to use constant colors between each stop or a gradient. |
horizontal | whether to get an horizontal or a vertical snapshot. |
width | the pixbuf width. |
height | the pixbuf height. |

#### Returns

the new GdkPixbuf.

[transfer full]

### gog_axis_color_map_to_cairo ()

    void
    gog_axis_color_map_to_cairo (GogAxisColorMap const *map,
                                 cairo_t *cr,
                                 unsigned  discrete,
                                 gboolean horizontal,
                                 double width,
                                 double height);

When `discrete` is larger than 1, it will be interpreted as the number of major ticks used. The number of colors will then be `discrete` − 1. Draws a snapshot of the color map inside the rectangle.

#### Parameters

map | a GogAxisMap |
cr | a cairo context. |
discrete | whether to use constant colors between each stop or a gradient. |
horizontal | whether to get an horizontal or a vertical snapshot. |
width | the rectangle width. |
height | the rectangle height. |

## Types and Values

### GogAxisColorMap

    typedef struct _GogAxisColorMap GogAxisColorMap;

## Property Details

### The `“resource-type”` property

      “resource-type”            GoResourceType

The resource type for the color map.

Flags: Read / Write / Construct Only

Default value: GO_RESOURCE_INVALID