Skip to content

Commit 3998116

Browse files
Correct update + example design
1 parent 5ab5cd7 commit 3998116

File tree

4 files changed

+70
-55
lines changed

4 files changed

+70
-55
lines changed

example/App.vue

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,26 @@
2424
alt="Vue.draggable logo"
2525
src="./assets/logo.png"
2626
/>
27-
<h1>vue.plotly</h1>
2827
<p><a
28+
class="title-link"
2929
href="https://github.com/David-Desmaisons/vue-plotly"
3030
target="_blank"
31-
>Vue.plotly</a> is a thin vue wrapper for
31+
><span class="title">Vue.plotly</span></a>a thin vue wrapper for
3232
<a
3333
href="https://plot.ly/javascript/"
3434
target="_blank"
3535
>plotly.js</a>
3636
</p>
3737
</div>
3838

39-
<div id="badges">
40-
<a
41-
target="_blank"
42-
href="https://github.com/David-Desmaisons/vue-plotly/issues"
43-
><img src="https://img.shields.io/github/issues/David-Desmaisons/vue-plotly.svg" /></a>
44-
<a
45-
target="_blank"
46-
href="https://circleci.com/gh/David-Desmaisons/vue-plotly"
47-
><img src="https://circleci.com/gh/David-Desmaisons/vue-plotly.svg?style=shield" /></a>
48-
<a
49-
target="_blank"
50-
href="https://codecov.io/gh/David-Desmaisons/vue-plotly"
51-
><img src="https://codecov.io/gh/David-Desmaisons/vue-plotly/branch/master/graph/badge.svg" /></a>
52-
<a
53-
target="_blank"
54-
href="https://www.npmjs.com/package/vue-plotly"
55-
><img src="https://img.shields.io/npm/v/vue-plotly.svg" /></a>
56-
<a
57-
target="_blank"
58-
href="https://github.com/David-Desmaisons/vue-plotly/blob/master/LICENSE"
59-
><img src="https://img.shields.io/github/license/David-Desmaisons/vue-plotly.svg" /></a>
60-
</div>
61-
6239
<div class="row justify-content-md-center">
6340
<div
6441
class="col-3 features"
6542
v-for="(data,idx) in features"
6643
:key="idx"
6744
>
6845
<div>
69-
<h5 class="card-title"><i :class="`fa ${data.icon}`"></i></h5>
46+
<h4 class="big-icone"><i :class="`fa ${data.icon}`"></i></h4>
7047
<p class="card-text">{{data.text}}</p>
7148
</div>
7249
</div>
@@ -76,8 +53,8 @@
7653

7754
<div class="card main-card">
7855
<form>
79-
<div class="form-group row">
80-
56+
<div class="row">
57+
8158
<div class="col-12">
8259
<select
8360
v-model="selected"
@@ -100,6 +77,13 @@
10077
/>
10178
</div>
10279
</div>
80+
81+
<footer class="footer fixed-bottom bg-dark">
82+
<div class="container">
83+
<img src="https://plot.ly/gh-pages/documentation/static//images/browser_support.png"/>
84+
</div>
85+
</footer>
86+
10387
</div>
10488
</template>
10589

@@ -145,7 +129,7 @@ export default {
145129
.logo {
146130
text-align: center;
147131
img {
148-
width: 70px;
132+
width: 80px;
149133
}
150134
}
151135
@@ -156,6 +140,13 @@ export default {
156140
}
157141
}
158142
}
143+
144+
.footer {
145+
text-align: center;
146+
img {
147+
height: 30px;
148+
}
149+
}
159150
}
160151
161152
.features {
@@ -185,4 +176,21 @@ export default {
185176
.main-card {
186177
padding: 0;
187178
}
179+
180+
footer.footer {
181+
background: darkgray;
182+
}
183+
184+
.big-icon {
185+
margin-bottom: 0;
186+
}
187+
188+
.title {
189+
font-size: 30px;
190+
color: black;
191+
}
192+
193+
a.title-link:hover {
194+
text-decoration: none;
195+
}
188196
</style>

example/components/generic.vue

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
<template>
22
<div>
33

4-
<div class="row">
5-
<div class="col-3">
6-
<div class="col">
7-
Markup:
8-
</div>
9-
</div>
10-
11-
<div class="col-9">
12-
<highlight-code
13-
lang="javascript"
14-
:code="code"
15-
/>
16-
</div>
17-
</div>
18-
194
<div class="row">
205
<div class="col-3">
216
<div class="col">
@@ -38,6 +23,16 @@
3823
</div>
3924

4025
<div class="col-9">
26+
27+
<div class="row">
28+
<div class="col">
29+
<highlight-code
30+
lang="javascript"
31+
:code="code"
32+
/>
33+
</div>
34+
</div>
35+
4136
<plotly
4237
v-bind="data.attr"
4338
:data="data.data"
@@ -80,11 +75,15 @@ export default {
8075
}
8176
8277
.data .jsoneditor-vue {
83-
height: 250px;
78+
height: 300px;
79+
}
80+
81+
.jsoneditor-vue div.jsoneditor-tree {
82+
min-height: 100px;
8483
}
8584
86-
.jsoneditor-vue div.jsoneditor-tree{
87-
min-height: 100px;
85+
.mark-up {
86+
margin-top: 8px;
8887
}
8988
</style>
9089

src/components/Plotly.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<template>
2-
<div :id="id" v-resize:debounce.100="onResize" />
2+
<div
3+
:id="id"
4+
v-resize:debounce.100="onResize"
5+
/>
36
</template>
47
<script>
58
import Plotly from "plotly.js";
@@ -83,7 +86,7 @@ export default {
8386
schedule(context) {
8487
const { scheduled } = this;
8588
if (scheduled) {
86-
Object.assign(scheduled, context);
89+
scheduled.replot = scheduled.replot || context.replot;
8790
return;
8891
}
8992
this.scheduled = context;

tests/unit/plotly.spec.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ describe("Plotly.vue", () => {
211211
const { error } = console;
212212

213213
beforeEach(() => {
214-
console.error = () => {};
214+
console.error = () => { };
215215
jest.clearAllMocks();
216216
update(wrapper);
217217
});
@@ -241,7 +241,7 @@ describe("Plotly.vue", () => {
241241
const { error } = console;
242242

243243
beforeEach(() => {
244-
console.error = () => {};
244+
console.error = () => { };
245245
jest.clearAllMocks();
246246
wrapper.setProps({ data: [{ data: "novo" }] });
247247
wrapper.vm.$attrs = { displayModeBar: "hover" };
@@ -271,7 +271,7 @@ describe("Plotly.vue", () => {
271271
const { error } = console;
272272

273273
beforeEach(() => {
274-
console.error = () => {};
274+
console.error = () => { };
275275
jest.clearAllMocks();
276276
const attrs = Object.assign({}, vm.$attrs);
277277
vm.$attrs = attrs;
@@ -323,11 +323,16 @@ describe("Plotly.vue", () => {
323323
});
324324
});
325325

326-
describe("when layout changes and data changes", () => {
326+
const changeData = () => wrapper.setProps({ data: { novo: "data" } });
327+
const changeLayout = () => wrapper.setProps({ layout: { novo: "layout" } });
328+
329+
describe.each([
330+
[() => { changeData(); changeLayout(); }],
331+
[() => { changeLayout(); changeData(); }],
332+
])("when layout changes and data changes", (changes) => {
327333
beforeEach(() => {
328334
jest.clearAllMocks();
329-
wrapper.setProps({ layout: { novo: "layout" } });
330-
wrapper.setProps({ data: { novo: "data" } });
335+
changes();
331336
});
332337

333338
it("calls plotly react once", async () => {

0 commit comments

Comments
 (0)