Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
prodige
bdl-alkante-visualiseur-core
Commits
44d7c35f
Commit
44d7c35f
authored
Oct 25, 2022
by
Jenkins
Browse files
Merge commit '
c3385e9f
'
parents
d3a444d6
c3385e9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
projects/visualiseur-core/src/lib/chart/chart.component.ts
View file @
44d7c35f
...
...
@@ -63,7 +63,7 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
private
htmlLegendPlugin
=
{
id
:
'
htmlLegend
'
,
afterUpdate
:
(
chart
,
args
,
options
)
=>
{
afterUpdate
:
(
chart
)
=>
{
const
ul
=
this
.
getOrCreateLegendList
();
// Remove old legend items
...
...
@@ -76,7 +76,8 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
items
.
forEach
(
item
=>
{
const
li
=
document
.
createElement
(
'
li
'
);
if
(
this
.
legendClass
){
if
(
this
.
legendClass
){
li
.
classList
.
add
(
this
.
legendClass
);
}
else
{
...
...
@@ -107,7 +108,7 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
boxSpan
.
style
.
borderColor
=
item
.
strokeStyle
;
boxSpan
.
style
.
borderWidth
=
item
.
lineWidth
+
'
px
'
;
if
(
!
this
.
legendClass
){
if
(
!
this
.
legendClass
){
boxSpan
.
style
.
display
=
'
inline-block
'
;
boxSpan
.
style
.
height
=
'
20px
'
;
boxSpan
.
style
.
marginRight
=
'
10px
'
;
...
...
@@ -120,7 +121,7 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
textContainer
.
style
.
color
=
item
.
color
;
textContainer
.
style
.
textDecoration
=
item
.
hidden
?
'
line-through
'
:
''
;
if
(
!
this
.
legendClass
){
if
(
!
this
.
legendClass
){
textContainer
.
style
.
margin
=
'
0
'
;
textContainer
.
style
.
padding
=
'
0
'
;
...
...
@@ -139,7 +140,6 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
};
ngOnInit
():
void
{
console
.
log
(
this
.
height
,
99
);
if
(
!
this
.
colors
||
!
(
this
.
colors
instanceof
Array
)
||
this
.
colors
.
length
===
0
)
{
this
.
colors
=
this
.
colorDefault
;
}
...
...
@@ -229,7 +229,7 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
const
dataSets
=
this
.
buildDataSet
(
this
.
datas
);
const
chartRef
=
new
Chart
(
ctx2d
,
{
plugins
:
[
ChartDataLabels
],
plugins
:
[
ChartDataLabels
,
this
.
htmlLegendPlugin
],
type
:
'
bar
'
,
data
:
{
...
...
@@ -303,9 +303,7 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
},
},
responsive
:
true
,
},
});
}
...
...
@@ -330,20 +328,6 @@ export class ChartComponent implements OnInit, AfterViewInit, OnDestroy {
return
text
.
charAt
(
0
).
toUpperCase
()
+
text
.
toLowerCase
().
slice
(
1
);
}
onAnimationComplete
(
event
)
{
const
chart
=
event
.
chart
;
console
.
log
(
315
,
chart
.
data
,
chart
.
ctx
,
chart
.
scales
.
x
,
chart
.
scales
);
//ctx.font = this.scale.font;
//ctx.fillStyle = this.scale.textColor;
//ctx.textAlign = "center";
//ctx.textBaseline = "bottom";
/*this.chartData.forEach( (dataset) => {
dataset.bars.forEach( (bar) => {
ctx.fillText(bar.value, bar.x, bar.y - 5);
});
})*/
}
ngOnDestroy
():
void
{
if
(
this
.
querySubscription
)
{
this
.
querySubscription
.
unsubscribe
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment