Skip to content

Commit b8581c2

Browse files
authored
Add legend and axis names to chart png export in PA (#2921)
* add legend and y axis name to chart png * add x axis title in png export * fix margin * display full text in legend * update legend border in export * chore:cleanup * refactor helper functions and update unit tests
1 parent 7d799dd commit b8581c2

4 files changed

Lines changed: 564 additions & 69 deletions

File tree

plugins/ui/apps/vue-mri-ui-lib/src/components/ImageExport.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import { mapActions, mapGetters } from 'vuex'
99
import MessageBox from './MessageBox.vue'
1010
import Constants from '../utils/Constants'
11-
import { createChartCanvas } from '../utils/ExportUtils'
11+
import { createChartCanvas, buildXAxisTitle } from '../utils/ExportUtils'
1212
import { generateDownloadFileName } from '../utils/generateDownloadFileName'
1313
1414
export default {
@@ -136,7 +136,17 @@ export default {
136136
}
137137
: null
138138
139-
const chartCanvas = createChartCanvas(chartId, chartType, targetHeight, targetWidth, pdfConst, kmLegendInput)
139+
const xAxisTitle = buildXAxisTitle(response?.categories)
140+
141+
const chartCanvas = createChartCanvas(
142+
chartId,
143+
chartType,
144+
targetHeight,
145+
targetWidth,
146+
pdfConst,
147+
kmLegendInput,
148+
xAxisTitle
149+
)
140150
141151
this.imageURL = chartCanvas.toDataURL('image/png')
142152
this.$refs.imgDownloadBtn.href = this.imageURL

plugins/ui/apps/vue-mri-ui-lib/src/components/StackBarChartLegend.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class="stackbar-legend-entry"
88
tabindex="0"
99
:aria-label="item.ariaLabel"
10+
:data-full-name="item.fullName"
1011
@mouseenter="item.isTruncated && showTooltip($event, item.fullName)"
1112
@mouseleave="hideTooltip"
1213
@focus="item.isTruncated && showTooltip($event, item.fullName)"

0 commit comments

Comments
 (0)