Forum Discussion

swamisharma's avatar
swamisharma
Frequent Visitor
1 year ago

Color Picker without color palette, need to have only conditional formatting button

Hello All,
I am currently working on custom visual formatting pane to add a color picker without the color palette button (color dropdown next to `fx` button), just need to have conditional formatting button (this fx button)
Current UI looks like

Expected (This is from Table visual > Format Pane > Cell Element Card)

I am currently using "Color Picker slice"

and this is my code in capabilities

"objects": {
        "values": {
            "properties": {
               "conditionalColor": {
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
            }
        }
    }

 

3 Replies

  • dm-p's avatar
    dm-p
    Icon for Super User rankSuper User

    Hi swamisharma,

     

    When you set up conditional formatting, you specify a VisualEnumerationInstanceKinds enum value as part of the properties. This should be set to Rule if you only wany the button and not the typical element rendered for the property.

     

    If you are trying this and it doesn't work you will need to create a support issue, as it will be a bug.

     

    Regards,

     

    Daniel

  • swamisharma's avatar
    swamisharma
    Frequent Visitor

    Hello dm-p ,
    We are already using the same enum while creating slices in formatting pane
    Please refer the code attached

    conditionalColor = new formattingSettings.ColorPicker({
            name: "conditionalColor",
            displayName: "Color",
            value: { value: undefined },
            altConstantSelector: null,
            instanceKind: powerbi.VisualEnumerationInstanceKinds.Rule,
            selector: dataViewWildcard.createDataViewWildcardSelector(dataViewWildcard.DataViewWildcardMatchingOption.InstancesAndTotals)
    });

    Can you please share how to create a support ticket?

    • dm-p's avatar
      dm-p
      Icon for Super User rankSuper User

      That looks correct. I've just tried it myself, and it might be a quirk of how the powerbi-visuals-utils-formattingmodel classes abstract a lot of the work away and handle the rendering of the newer formatting pane components. I confess, the last time I wanted this specific situation was before these utilities were made available, and you had to construct the formatting model using the visual host directly.

       

      I would indeed suggest asking the custom visuals team for an example they can give you. You can contact them at [email protected]

       

      Best of luck (and if you get a workable example, it would be great to know if it's possible!),

       

      Daniel