Open rtodo opened 5 years ago
@rtodo You have to wrap your data with a container and apply the class to it, not the template. So something like:
<ng-template #tooltipTemplate let-model="model">
<div class="tooltip">
This is the single point tooltip template
<pre class="test">{{model|json}}</pre>
</div>
</ng-template>
no need ::ng-deep
@rtodo You have to wrap your data with a container and apply the class to it, not the template. So something like:
<ng-template #tooltipTemplate let-model="model"> <div class="tooltip"> This is the single point tooltip template <pre class="test">{{model|json}}</pre> </div> </ng-template>
no need ::ng-deep
But what if I want to change the tooltip container background color ?
Tooltip is a global element and cannot be styled with ::ng-deep
.
I was able to style the tooltip using global css styles:
ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip {
.tooltip-caret.position-top {
border-top-color: white;
box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2);
}
background-color: white;
box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2);
}
Tooltip is a global element and cannot be styled with
::ng-deep
. I was able to style the tooltip using global css styles:ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip { .tooltip-caret.position-top { border-top-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); } background-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
Thank You ❤❤
Tooltip is a global element and cannot be styled with
::ng-deep
. I was able to style the tooltip using global css styles:ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip { .tooltip-caret.position-top { border-top-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); } background-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
You are a hero, thank you. How did you find these class paths?
I was able to use this as an example only had to make one change. I had to go into my component and setting the encapsulation to "ViewEncapsulation.None" then I had no problems formatting the tool tip.
ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip { .tooltip-caret.position-top { border-top-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
background-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
I was able to use this as an example only had to make one change. I had to go into my component and setting the encapsulation to "ViewEncapsulation.None" then I had no problems formatting the tool tip.
ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip { .tooltip-caret.position-top { border-top-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
background-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
This is genious! I spent so much time already trying to find out why it is either global styles or ng-deep... Thanks a lot mardon1975 :)
This works all the time, but i want to change the tooltip colour only when the theme is dark, so i tried using the classes inside :host-context(.dark){}, but they don't work anymore, kindly help. I tried changing view capsulation to None as well but, no luck
For anyone still wondering about background colors.
I put this in global:
.ngx-charts-tooltip-content.type-tooltip {
background-color: $light !important;
}
::ng-deep ngx-tooltip-content.ngx-charts-tooltip-content.type-tooltip { .tooltip-caret.position-top { border-top-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
color: black; padding: 10px 15px; background-color: white; box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.2); }
How to make tooltips always appear?
How to make tooltips always appear?
@morshedmasud
you can use showDataLabel
input, or you can make the display of .ngx-charts-tooltip-content
to block !important
@ahmedkhairydev
bur for ngx-charts-bar-vertical-normalized
chart there is no property called showDataLabel
bur for
ngx-charts-bar-vertical-normalized
chart there is no property calledshowDataLabel
@morshedmasud
showDataLabel
for basic & grouped bar charts only.
is there any way to make tooltips always appear with ngx-charts-bar-vertical-normalized
chart?
I would like to be able to put custom style to tooltips template.
I don't really know how that kind of thing are handled in other library but just being able to inject css in the component style would already be quite usefull.
I already tried to reach the tooltips level with ::ng-deep like this:
Html:
Less:
But it didn't work, maybe there is a workaround ?