简体   繁体   中英

Specifying different offset for each slice of a Shield UI JavaScript pie chart

Is it possible to specify a separate offset value for each of the slices of a pie chart? I am using ShieldUI JavaScript chart, but as per the documentation I only see this possibility of setting it up:

seriesSettings: {
    pie: {
        activeSettings: {
            pointSelectedState: {
                enabled: true
            }
        },
        enablePointSelection: true,
        slicedOffset: 20,
        addToLegend: true,
        dataPointText: {
            enabled: true,
            borderRadius: 4,
            borderWidth: 2,
            borderColor: "red"
        }
    }
}, 

There isn't :

slicedOffset[0]: 10,
slicedOffset[1]: 20,
slicedOffset[2]: 30,

and so on. How can I achieve the desired behavior?

It is not possible to specify different offsets for each slice of a Shield UI JavaScript pie chart. The slicedOffset applies for all of the slices of a given chart. However there are some workarounds depending on what exactly you need to be accomplished.

  1. If the chart is related to another one you may specify a predefined parameter and assign its value to the slicedOffset property. However it will again apply for all the slices.

  2. It is also possible, using the events of the chart to recreate it, after a slice has been clicked on. In this case an additional parameter will be specified, which to take account of which slice has been clicked on so that this slice's property can be set to true :

    sliced: true

  3. If the different sliced offsets values are quite important you may also wish to use related controls: for instance a drop down. In this case, avoiding the shortcomings of the previous two solutions selecting an item from the dropdown you will recreate the chart and set different offset for the selected slice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM