Skip to content

Commit 9bbb037

Browse files
committed
Add download props to Legend component, export downloadSvg util
1 parent 62048e3 commit 9bbb037

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/components/legends/Legend.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@
88
:getScale="getScale"
99
:getStack="getStack"
1010
:clickHandler="clickHandler"
11+
:showDownloadButton="showDownloadButton"
12+
:downloadName="downloadName"
1113
/>
1214
<ContinuousLegend v-if="legendType === 'continuous'"
1315
:variable="variable"
1416
:lWidth="lWidth"
1517
:lItemHeight="lItemHeight"
1618
:getScale="getScale"
1719
:getStack="getStack"
20+
:showDownloadButton="showDownloadButton"
21+
:downloadName="downloadName"
1822
/>
1923
</div>
2024
</template>
@@ -69,6 +73,14 @@ export default {
6973
},
7074
'clickHandler': {
7175
type: Function
76+
},
77+
'showDownloadButton': {
78+
type: Boolean,
79+
default: false
80+
},
81+
'downloadName': {
82+
type: String,
83+
default: 'legend'
7284
}
7385
},
7486
data() {

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import Expected from './expected';
5050

5151
// Other
5252
import { EVENT_TYPES, EVENT_SUBTYPES, EVENT_SUBTYPE_RESETS } from './history/base-events';
53+
import { downloadSvg } from './helpers';
5354

5455
// Reference: https://stackoverflow.com/questions/28282295/getbbox-of-svg-when-hidden
5556
const _getBBox = SVGGraphicsElement.prototype.getBBox;
@@ -120,4 +121,5 @@ export {
120121
// Other
121122
computedParam,
122123
EVENT_TYPES, EVENT_SUBTYPES, EVENT_SUBTYPE_RESETS,
124+
downloadSvg,
123125
}

0 commit comments

Comments
 (0)