How to apply custom height and width of visuals? - powerbi

I have 10 visuals in my embedded report. I want to remove the some specific visuals and want to set the height and width of the remaining visuals to make the fit to the report. Is it possible to set the height and width of visuals after removing or hiding visuals?

You can do this by applying custom layout to your report. You can hide all the visuals and then show only the required visuals with updated height and width. To hide the visuals you can set the mode as Hidden in page Layout.
Please find the below code snippet:
Hide all the visuals and set height and width of report page:
const defaultLayout = {
width: "Required_Width",
height: "Required_Height",
displayState: {
mode: models.VisualContainerDisplayMode.Hidden
}
};
Update height and width of your required visual:
const pageLayout = {
defaultLayout: defaultLayout,
visualsLayout: {
"Required_Visual_Name": {
x: "Required_Width",
y: "Required_Height",
displayState: {
mode: models.VisualContainerDisplayMode.Visible
}
},
}
};
Update the settings:
const settings = {
layoutType: models.LayoutType.Custom,
customLayout: {
displayOption: models.DisplayOption.FitToPage,
pagesLayout: {
"Your_Report_Id": pageLayout
}
},
}
Apply the settings:
await report.updateSettings(settings);
You can refer the Personalize top insights showcase in Power BI Playground:https://playground.powerbi.com/showcases-gallery/personalize-top-insights
You get the code reference for this showcase here:
https://github.com/microsoft/PowerBI-Embedded-Showcases/tree/main/Personalize%20top%20insights
Please find the reference here:
https://learn.microsoft.com/javascript/api/overview/powerbi/custom-layout

Related

Oracle Apex font on a row selector

I have been asked if I can modify my oracle apex interactive grid to make the row selector column wider, bold and add a title is possible. I know how to do this for a column but I am not sure it is possible for an interactive grid row selector. Any help or an example would be helpful.. Thank you
Wow, this was a tricky one. I think I've figured it out (many thanks to John Snyders!). Assuming the IG has an id of 'emp', the following should work:
Add the following CSS to the page's Inline property under CSS. This will handle the styling of the checkbox, the checkmark in the checkbox, and it will show the column's header which is hidden by default. You can remove the #emp selector if you want to target all IGs on a page.
/* Style the box */
#emp .u-selector {
border: 2px solid #000;
padding: .5px;
}
/* Style the check in the box */
#emp .u-selector:before {
font-weight: 900;
color: #000;
}
/* Show the row selector column header */
#emp .a-GV-headerLabel {
position: relative;
}
#emp .a-GV-table th {
white-space: normal;
}
Next, add the following JavaScript code to the page's Execute when Page Loads property under JavaScript.
var igRegionId = 'emp';
var widgetInst = apex.region(igRegionId).call('getViews').grid.view$.data('apex-grid');
var orgRefresh = widgetInst.refresh;
widgetInst.refresh = function() {
orgRefresh.call(widgetInst);
$('.u-vh.a-GV-headerLabel').text('Hello World!');
};
widgetInst.refresh();
Finally, add the following JavaScript to the IG region > Attributes > JavaScript Initialization Code. This will resize the column as needed:
function(config) {
config.defaultGridViewOptions = {
rowHeaderWidth: 100
};
return config;
}

How to change column width and height dynamically in amChart JS Radar column series charts?

I am trying to change series column width and height dynamically in amChart JS Radarchart, but it is not working. Please find the below code and let me know the suggestion.
var series = chart.series.push(new am4charts.RadarColumnSeries());
series.columns.template.adapter.add("width", function(text, target, key) {
console.log('hit');
return am4core.percent(10);
});
series.columns.template.adapter.add("height", function(text, target, key) {
console.log('hit');
return am4core.percent(10);
});

Ionic2, Content width and height is showing 0

I am using Ionic2 for a hybrid app. I have a requirement where I need the height + width of Content area (ion-content).
I am trying
#ViewChild(Content) content: Content;
console.log(this.content.contentWidth,this.content.contentHeight)
this is giving 0,0
when I try console.log(this.content.getContentDimensions());
It gives
{"contentHeight":null,"contentWidth":525,"contentLeft":0,"scrollHeight":1023,"scrollTop":0,"scrollWidth":510,"scrollLeft":0}
How can I get ion-content (viewable area) width and height.
Try This...
ionViewDidLoad() {
setTimeout(() => {
console.log("some....",this.content.contentHeight);
this.contentHeight = this.content.contentHeight;
console.log("some....",this.contentHeight);
}, 10);
}

How can i add additional Data(Type) to chart.js

i had already done adding a click handler to each Segment of my doughnut chart with adding the following Code :
$("#myChart").click(
function(evt){
var activePoints = myNewChart.getSegmentsAtEvent(evt);
var chartelementid = activePoints[0].label;
alert(chartelementid);
//$('.details div').css("display", "none");
//$('#' + chartelementid).show();
}
);
This works fine, when finished it should display an additional Div with Details for this segment.
Unfortunality my labels are more then just Single Words, so i'm struggeling to create div ID's with the same name...
My Idea is to add to every Segment an additional Data like value,label, etc. so it could be an ID. but if i just add the ID information to the Segment it will not exist as variable.
Add DataType:
var dataImprove = [
{
value: 30,
color:"#001155",
highlight: "#1c2f7c",
label: "KnowHow Erhalt / Transfer & Aufbau",
id:"test"
}
]
where can i add in chart.js an additional dataType like shown above my ID to be accessible in the DOM?
kind regards Marco
As an alternative pass a JSON string as your label, then intercept to render. For example:
var canvas = document.getElementById(id);
var d = canvas.getContext("2d");
var chart = new Chart(d).Pie(json, {
segmentStrokeWidth: 1,
tooltipTemplate: "<%=label%>", //default the label
customTooltips: function (tooltip) {
// Hide if no tooltip
if (!tooltip) {
return;
}
var tooltipObj = JSON.parse(tooltip.text);
// etc
already found : between line 999 and 1023 in chart.js before drawing - i've added the line
id: ChartElements[0].id,
so the Data with the name ID is in the DOM avaiable.

Oracle APEX: Tooltip on cell of the report

I have an APEX tabular form, all columns of which are standard report columns.
Is it possible to display a tooltip on mouse over of a particular cell of the report?
In the report column attributes look for the region named Column Formatting. Inside this section is a text box for an "HTML Expression". Here you can add html to the report column contents e.g., <span title="My tooltip text">#COLUMN_NAME#</span>
The tooltip text could be from another column, you would just replace the contents of the title attribute with the column name surrounded by hashes.
SOLUTION 1:
If your record needs to be editable then this solution works:
Under column attributes go to LINK
For Target: Type - URL and URL is just a hashtag
URL: #
Link Text: &COLUMN_NAME.
Link Attributes: title="&COLUMN_NAME." class="column_name_class"
Then in your inline CSS add the following
.column_name_class{
text-decoration: none !important;
}
Solution one I definitely prefer. But here is solution 2 anyways.
SOLUTION 2:
See here for the solution on JSDoc: Widget Grid
You can also initialize the grid with the tooltip option specified.
function( options ) {
options.defaultGridViewOptions = {
tooltip: {
content: function( callback, model, recordMeta, colMeta, columnDef ) {
var text;
// calculate the tooltip text
return text;
}
}
};
return options;
}
} );
Calculating the tooltip :
config.defaultGridViewOptions = {
tooltip: {
content: function( callback, model, recordMeta, colMeta, columnDef ) {
return model.getValue( recordMeta.record, "COLUMN_NAME");
}
}
}