cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Questions regarding breadcrumbs/title in my custom visual

Hi all,

 

I have been building some nice custom visuals. Onething I can't figure out yet in my D3 visuals is how I can disable the breadcrumbs row telling me what category and measure I selected from my code. Is this something I can do in one of the .Json config files?  Can some one tell me how to do this? 

 

Thanks in advanced!

 

example

 

Cheers,

 

Jorrit Idsingh

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Questions regarding breadcrumbs/title in my custom visual

You should implement enumerateObjectInstances method in the class that implements IVisual interface.

Basic implementation might look something like this:

enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
    return [];
}

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

Highlighted
Regular Visitor

Re: Questions regarding breadcrumbs/title in my custom visual

Pfff that was a while ago 🙂 I looked in my code and I think for me this did the job!

 

 

Add an additional file : objectEnumerationUtility.ts to the project with the following code: 

 

module powerbi.extensibility.visual {
/**
* Gets property value for a particular object.
*
* @function
* @param {DataViewObjects} objects - Map of defined objects.
* @param {string} objectName - Name of desired object.
* @param {string} propertyName - Name of desired property.
* @param {T} defaultValue - Default value of desired property.
*/
export function getValue<T>(objects: DataViewObjects, objectName: string, propertyName: string, defaultValue: T 😞 T {
if (objects) {
let object = objects[objectName];
if (object) {
let property: T = <T>object[propertyName];
if (property !== undefined) {
return property;
}
}
}
return defaultValue;
}

/**
* Gets property value for a particular object in a category.
*
* @function
* @param {DataViewCategoryColumn} category - List of category objects.
* @param {number} index - Index of category object.
* @param {string} objectName - Name of desired object.
* @param {string} propertyName - Name of desired property.
* @param {T} defaultValue - Default value of desired property.
*/
export function getCategoricalObjectValue<T>(category: DataViewCategoryColumn, index: number, objectName: string, propertyName: string, defaultValue: T): T {
let categoryObjects = category.objects;

if (categoryObjects) {
let categoryObject: DataViewObject = categoryObjects[index];
if (categoryObject) {
let object = categoryObject[objectName];
if (object) {
let property: T = <T>object[propertyName];
if (property !== undefined) {
return property;
}
}
}
}
return defaultValue;
}
}

 

Then update visual.ts 

 

add this fuction:

 

/**
* Enumerates through the objects defined in the capabilities and adds the properties to the format pane
*
* @function
* @param {EnumerateVisualObjectInstancesOptions} options - Map of defined objects
*/

public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
let objectName = options.objectName;
let objectEnumeration: VisualObjectInstance[] = [];


return objectEnumeration;
}

 

My contructor looked like this:

 

constructor(options: VisualConstructorOptions) {
this.mainContainer = $('<div>');
this.host = options.host;
this.selectionManager = options.host.createSelectionManager();

$(options.element)

.append(this.mainContainer);

}

 

View solution in original post

7 REPLIES 7
Highlighted
Community Champion
Community Champion

Re: Questions regarding breadcrumbs/title in my custom visual

This title can be turned off using formatting panel at Title section.

Please note that there's no way to turn this title off from custom visual's code.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Highlighted
Regular Visitor

Re: Questions regarding breadcrumbs/title in my custom visual

Thanks Ignat! I knew that was one option but in my visual the formating pannel is complely empty so also does not have the title options. I created the visueal from scrats so then might need to enable or implement all those options somehow. I guess. Any pointers here?

 

Kind regards,

 

Jorrit 

Highlighted
Community Champion
Community Champion

Re: Questions regarding breadcrumbs/title in my custom visual

You should implement enumerateObjectInstances method in the class that implements IVisual interface.

Basic implementation might look something like this:

enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
    return [];
}

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

Highlighted
Regular Visitor

Re: Questions regarding breadcrumbs/title in my custom visual

Great! Found some examples. I think I will manage to fix it now!

 

Thanks again!

Highlighted
Helper I
Helper I

Re: Questions regarding breadcrumbs/title in my custom visual

@Jorrit Can you please share that example? I'm in the same situation where you were standing.

Highlighted
Regular Visitor

Re: Questions regarding breadcrumbs/title in my custom visual

Pfff that was a while ago 🙂 I looked in my code and I think for me this did the job!

 

 

Add an additional file : objectEnumerationUtility.ts to the project with the following code: 

 

module powerbi.extensibility.visual {
/**
* Gets property value for a particular object.
*
* @function
* @param {DataViewObjects} objects - Map of defined objects.
* @param {string} objectName - Name of desired object.
* @param {string} propertyName - Name of desired property.
* @param {T} defaultValue - Default value of desired property.
*/
export function getValue<T>(objects: DataViewObjects, objectName: string, propertyName: string, defaultValue: T 😞 T {
if (objects) {
let object = objects[objectName];
if (object) {
let property: T = <T>object[propertyName];
if (property !== undefined) {
return property;
}
}
}
return defaultValue;
}

/**
* Gets property value for a particular object in a category.
*
* @function
* @param {DataViewCategoryColumn} category - List of category objects.
* @param {number} index - Index of category object.
* @param {string} objectName - Name of desired object.
* @param {string} propertyName - Name of desired property.
* @param {T} defaultValue - Default value of desired property.
*/
export function getCategoricalObjectValue<T>(category: DataViewCategoryColumn, index: number, objectName: string, propertyName: string, defaultValue: T): T {
let categoryObjects = category.objects;

if (categoryObjects) {
let categoryObject: DataViewObject = categoryObjects[index];
if (categoryObject) {
let object = categoryObject[objectName];
if (object) {
let property: T = <T>object[propertyName];
if (property !== undefined) {
return property;
}
}
}
}
return defaultValue;
}
}

 

Then update visual.ts 

 

add this fuction:

 

/**
* Enumerates through the objects defined in the capabilities and adds the properties to the format pane
*
* @function
* @param {EnumerateVisualObjectInstancesOptions} options - Map of defined objects
*/

public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration {
let objectName = options.objectName;
let objectEnumeration: VisualObjectInstance[] = [];


return objectEnumeration;
}

 

My contructor looked like this:

 

constructor(options: VisualConstructorOptions) {
this.mainContainer = $('<div>');
this.host = options.host;
this.selectionManager = options.host.createSelectionManager();

$(options.element)

.append(this.mainContainer);

}

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Questions regarding breadcrumbs/title in my custom visual

@Jorrit Thank you so much Smiley Happy

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors