Skip to content

Commit

Permalink
[1748] Underline and strike-through not taken into account for BarCharts
Browse files Browse the repository at this point in the history
Bug: #1748
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD authored and pcdavid committed Mar 6, 2023
1 parent 49b2471 commit 41bf373
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -35,6 +35,7 @@
- https://github.com/eclipse-sirius/sirius-components/issues/1773[#1773] [workbench] Fix editors area tab title may hide close button
- https://github.com/eclipse-sirius/sirius-components/issues/1541[#1541] [workbench] Editors area can overflow on Details view
- https://github.com/eclipse-sirius/sirius-components/issues/1708[#1708] [forms] Fix the impossibility to move a toolbar action from a group to another with no toolbar actions in FormDescriptionEditors.
- https://github.com/eclipse-sirius/sirius-components/issues/1748[#1748] [chart] Underline and strike-through style options are not taken into account for BarCharts.

=== New Features

Expand Down
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 2023 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -69,15 +69,15 @@ export const BarChart = ({ chart }: BarChartProps) => {

const selection = d3.select(d3Container.current);
selection.selectAll('*').remove(); // Remove existing content.
const svg = selection.attr('viewBox', [0, 0, width, height]).attr('pointer-events', 'none'); // allow selection anywhere in the svg
const svg = selection
.attr('viewBox', [0, 0, width, height])
.attr('text-decoration', textDecoration)
.attr('pointer-events', 'none'); // allow selection anywhere in the svg

svg
.append('g')
.attr('transform', `translate(${marginLeft},0)`)
.attr(
'style',
`font-size:${fontSize}; font-style: ${fontStyle}; text-decoration: ${textDecoration}; font-weight: ${fontWeight}`
)
.attr('style', `font-size:${fontSize}; font-style: ${fontStyle}; font-weight: ${fontWeight}`)
.call(yAxis)
.call((g) => g.select('.domain').remove())
.call((g) =>
Expand Down Expand Up @@ -115,10 +115,7 @@ export const BarChart = ({ chart }: BarChartProps) => {
svg
.append('g')
.attr('transform', `translate(0,${height - marginBottom})`)
.attr(
'style',
`font-size:${fontSize}; font-style: ${fontStyle}; text-decoration: ${textDecoration}; font-weight: ${fontWeight}`
)
.attr('style', `font-size:${fontSize}; font-style: ${fontStyle}; font-weight: ${fontWeight}`)
.call(xAxis);
}
}, [chart, d3Container]);
Expand Down
Expand Up @@ -459,14 +459,15 @@ exports[`render the bar-chart widget 1`] = `
<svg
height="250"
pointer-events="none"
text-decoration="none"
viewBox="0,0,500,250"
width="500"
>
<g
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:14; font-style: normal; text-decoration: none; font-weight: normal"
style="font-size:14; font-style: normal; font-weight: normal"
text-anchor="end"
transform="translate(50,0)"
>
Expand Down Expand Up @@ -641,7 +642,7 @@ exports[`render the bar-chart widget 1`] = `
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:14; font-style: normal; text-decoration: none; font-weight: normal"
style="font-size:14; font-style: normal; font-weight: normal"
text-anchor="middle"
transform="translate(0,220)"
>
Expand Down Expand Up @@ -746,14 +747,15 @@ exports[`render the bar-chart widget with empty style 1`] = `
<svg
height="250"
pointer-events="none"
text-decoration="none"
viewBox="0,0,500,250"
width="500"
>
<g
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:12; font-style: normal; text-decoration: none; font-weight: normal"
style="font-size:12; font-style: normal; font-weight: normal"
text-anchor="end"
transform="translate(50,0)"
>
Expand Down Expand Up @@ -928,7 +930,7 @@ exports[`render the bar-chart widget with empty style 1`] = `
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:12; font-style: normal; text-decoration: none; font-weight: normal"
style="font-size:12; font-style: normal; font-weight: normal"
text-anchor="middle"
transform="translate(0,220)"
>
Expand Down Expand Up @@ -1033,14 +1035,15 @@ exports[`render the bar-chart widget with style 1`] = `
<svg
height="250"
pointer-events="none"
text-decoration="line-through underline"
viewBox="0,0,500,250"
width="500"
>
<g
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:15; font-style: italic; text-decoration: line-through underline; font-weight: bold"
style="font-size:15; font-style: italic; font-weight: bold"
text-anchor="end"
transform="translate(50,0)"
>
Expand Down Expand Up @@ -1215,7 +1218,7 @@ exports[`render the bar-chart widget with style 1`] = `
fill="none"
font-family="sans-serif"
font-size="10"
style="font-size:15; font-style: italic; text-decoration: line-through underline; font-weight: bold"
style="font-size:15; font-style: italic; font-weight: bold"
text-anchor="middle"
transform="translate(0,220)"
>
Expand Down

0 comments on commit 41bf373

Please sign in to comment.