Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
VizDataLtd
Helper I
Helper I

Formatting pane: line alignment

Hello there,

 

I am upgrading my custom visuals from 2.6 to 5.3 - a massive leap in one go. One thing I can't get to work is the Alignment Group.

 

Within 

 

class DataPointCardSettings extends FormattingSettingsCard {

 

I have the code:

 

    labelAlignment = new formattingSettings.AlignmentGroup({
        name: "labelAlignment",
        displayName: "Label alignment",
        mode: powerbi.visuals.AlignmentGroupMode.Horizonal,
        value: { value: "right" }
    });

 

I can't compile. I get the error: Type {value:string} is not assignable to type "string".

 

I have tried true / false, I have tried blank, but no joy.

 

I am using settings.ts, because I am modifying and copying code into the circleCard example. The example I have found online appears to change the code in visual.ts only: Customize the format pane in Power BI custom visuals - Power BI | Microsoft Learn

 

Can I still use both settings.ts and visual.ts, or should I just be using visual.ts?

 

The code below (taken from the link above) implies you can assign a string of "right" to value. Any ideas? Thanks

 

VizDataLtd_0-1706619868340.png

 

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @VizDataLtd 

I haven't tried implementing the alignment settings in formatting cards yet, but from looking at the error:

 

Type {value:string} is not assignable to type "string"

 

This suggests assigning a string to the value property, not an object. Your reference example shows this, too. I would try amending as follows:

 

    labelAlignment = new formattingSettings.AlignmentGroup({
        name: "labelAlignment",
        displayName: "Label alignment",
        mode: powerbi.visuals.AlignmentGroupMode.Horizonal,
        value: "right"   // string rather than object
    });

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




View solution in original post

1 REPLY 1
dm-p
Super User
Super User

Hi @VizDataLtd 

I haven't tried implementing the alignment settings in formatting cards yet, but from looking at the error:

 

Type {value:string} is not assignable to type "string"

 

This suggests assigning a string to the value property, not an object. Your reference example shows this, too. I would try amending as follows:

 

    labelAlignment = new formattingSettings.AlignmentGroup({
        name: "labelAlignment",
        displayName: "Label alignment",
        mode: powerbi.visuals.AlignmentGroupMode.Horizonal,
        value: "right"   // string rather than object
    });

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


My course: Introduction to Developing Power BI Visuals


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors