go-echarts / go-echarts

🎨 The adorable charts library for Golang

Home Page:https://go-echarts.github.io/go-echarts/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Include all series dataset encoding options listed in documentation

LJ-Software opened this issue · comments

The series dataset encoding options here include only the fields X and Y even though the echarts documentation (which is linked in the code there) lists more options that work with any series or coordinate. Quoting the docs:

The basic structure of encode is illustrated as follows, where the left part of colon is the name of axis like 'x', 'y', 'radius', 'angle' or some special reserved names like "tooltip", "itemName" etc., and the right part of the colon is the dimension names or dimension indices (based on 0). One or more dimensions can be specified. Usually not all of mappings need to be specified, only specify needed ones.

The properties available in encode listed as follows:

// In any of the series and coordinate systems,
// these properties are available:
encode: {
    // Display dimension "product" and "score" in the tooltip.
    tooltip: ['product', 'score']
    // Set the series name as the concat of the names of dimensions[1] and dimensions[3].
    // (sometimes the dimension names are too long to type in series.name manually).
    seriesName: [1, 3],
    // Using dimensions[2] as the id of each data item. This is useful when dynamically
    // update data by `chart.setOption()`, where the new and old data item can be
    // corresponded by id, by which the appropriate animation can be performed when updating.
    itemId: 2,
    // Using dimensions[3] as the name of each data item. This is useful in charts like
    // 'pie', 'funnel', where data item name can be displayed in legend.
    itemName: 3,
    // Using dimensions[4] as the groupId of each data item. groupId will be used to categorize the data. And to determine
    // How the merge and split animation are performed in the universal transition. See universalTransition option for detail.
    itemGroupId: 4
}

// These properties only work in cartesian(grid) coordinate system:
encode: {
    // Map dimensions[1], dimensions[5] and dimension "score" to the X axis.
    x: [1, 5, 'score'],
    // Map dimensions[0] to the Y axis.
    y: 0
}

// These properties only work in polar coordinate system:
encode: {
    radius: 3,
    angle: 2,
    ...
}

// These properties only work in geo coordinate system:
encode: {
    lng: 3,
    lat: 2
}

// For some type of series that are not in any coordinate system,
// like 'pie', 'funnel' etc.:
encode: {
    value: 3
}

The request is to include the options that apply to every series or coordinate, but it would be nice to also have a way to use the encoding options that apply to only certain series types as are listed in the above docs.