Skip to content

Commit 2ca8012

Browse files
Add defition of the data property.
1 parent aa60551 commit 2ca8012

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

demo/index.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@
1818
</style>
1919
<body>
2020
<ternary-plot side="400"></ternary-plot>
21+
<button>show new data</button>
2122
</body>
2223
<script>
2324
const element = document.querySelector('ternary-plot');
24-
// Set data as a dynamic property.
25-
element.data = getRandomData(20);
25+
// element.data = getRandomData(20);
26+
27+
const button = document.querySelector('button');
28+
29+
button.addEventListener('click', event => {
30+
element.data = getRandomData(20);
31+
});
2632

2733
function getRandomData (length) {
2834
return {

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {html, define} from 'hybrids';
1+
import {html, define, property} from 'hybrids';
22
import style from './style';
33
import {
44
width,
@@ -113,6 +113,14 @@ function render({
113113
}
114114

115115
export const TernaryPlot = {
116+
data: property({
117+
titles: {
118+
bottom: '',
119+
right: '',
120+
left: ''
121+
},
122+
data: []
123+
}),
116124
side: 400,
117125
numberOfTicks: 10,
118126
tickLenght: 10,

0 commit comments

Comments
 (0)