简体   繁体   中英

Preselecting multiple slices of Shield UI Pie Chart

I need a ShieldUI JavaScript pie chart that use on a page in which some slices are preselected. I researched the available resources and pretty much figured it out. However my further intention is to return back(or collapse back) preselected slices in place after the user clicks on the pie or on another pie slice. Here is some of my code:

dataSeries: [{
seriesType:'pie',
collectionAlias:'Usage',
    data: [
        ['Category A', 44.2],
        ['Category B', 22.2],
        ['Category C', 20],
        {
collectionAlias:'Category C',
            y: 12.8,
            selected: true
        },
        ['Category D', 20],
        {
collectionAlias:  'Category D',
            y: 22.8,
            selected: true
        },
        ['Category E', 20],
        {
collectionAlias: 'Category E',
            y: 32.8,
            selected: true
        },

    ]
}]

I assumed the selected property might be the problem and changed it to sliced:

dataSeries: [{
seriesType:             'pie',
collectionAlias:             'Usage',
    data: [
        ['Category A', 44.2],
        ['Category B', 22.2],
        ['Category C', 20],
        {
collectionAlias: 'Category C',
            y: 12.8,
            sliced: true
        },
        ['Category D', 20],
        {
collectionAlias: 'Category D',
            y: 22.8,
            sliced: true
        },
        ['Category E', 20],
        {
collectionAlias:'Category E',
            y: 32.8,
            sliced: true
        },

    ]
}]

However the result is still the same. I can hover the slices- they change color, but nothing more. The preselected ones remain off center.

As it seems from your partial code one reason I can think of, especially judging by the resulting behavior, is that you have omitted the enablePointSelection property. you need to set it to true similar to this code:

seriesSettings: {
  pie: {
       enablePointSelection: true,
       slicedOffset: 19
       }
 },

The obvious reason for that is that in order to put back the preselected slices you need to be able to select another one.

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