Skip to content

Commit 81791a2

Browse files
committed
add default config
1 parent bc31c3f commit 81791a2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

histogram/ccm.histogram.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
*/
8181
this.init = async () => {
8282

83+
// set shortcut to help functions
84+
$ = self.ccm.helper;
85+
8386
// Is config given via LightDOM (inner HTML of Custom Element)?
8487
// Then use it with higher priority
8588
if ( self.inner && self.inner.innerHTML.trim() ){
@@ -94,16 +97,6 @@
9497

9598
};
9699

97-
/**
98-
* is called once after the initialization and is then deleted
99-
*/
100-
this.ready = async () => {
101-
102-
// set shortcut to help functions
103-
$ = self.ccm.helper;
104-
105-
};
106-
107100
/**
108101
* starts the instance
109102
*/
@@ -112,9 +105,17 @@
112105
// has logger instance? => log 'start' event
113106
self.logger && self.logger.log( 'start' );
114107

108+
// Default values
109+
self.html.main = $.integrate( self.html.main, {
110+
tag: 'svg',
111+
width:"100",
112+
height:"100",
113+
inner: []
114+
} );
115+
115116
const dimensions = Object.keys( self.data );
116117
const dim_count = dimensions.length;
117-
let list = self.html.main.inner;
118+
const list = self.html.main.inner;
118119

119120
dimensions.map( (dim, index) => {
120121
const width = parseFloat( self.html.main.width ) / dim_count;
@@ -129,7 +130,7 @@
129130
height: self.data[ dim ],
130131
inner: { tag: 'title', inner: dim + ': ' + self.data[ dim ] }
131132
};
132-
list.push( $.integrate(rect, $.integrate( self.styles, self.styles[ dim ])) );
133+
list.push( $.integrate(rect, $.integrate( self.styles[ dim ], self.styles ) ) );
133134
list.push( $.clone( $.integrate( { tag:'text',
134135
x: index * width + 0.5 * width,
135136
y: height - 10,

0 commit comments

Comments
 (0)