Skip to content

Commit 77fc683

Browse files
committed
fix: add more significant digits to y-axis
1 parent 88eaa85 commit 77fc683

9 files changed

+19
-19
lines changed

packages/synchro-charts/cypress/integration/charts/bar-chart/draggable-annotations.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ it('draggable annotation rescales axis in positive direction', () => {
7070
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
7171
cy.get('g.axis.y-axis > g.tick > text')
7272
.eq(16)
73-
.should('have.text', '8.0k');
73+
.should('have.text', '8k');
7474
cy.get('g.axis.y-axis > g.tick > text')
7575
.eq(0)
76-
.should('have.text', '0.0');
76+
.should('have.text', '0');
7777
});
7878

7979
it('draggable annotation rescales axis in negative direction', () => {
@@ -90,10 +90,10 @@ it('draggable annotation rescales axis in negative direction', () => {
9090
cy.get('g.axis.y-axis > g.tick').should('have.length', 9);
9191
cy.get('g.axis.y-axis > g.tick > text')
9292
.eq(8)
93-
.should('have.text', '3.0k');
93+
.should('have.text', '3k');
9494
cy.get('g.axis.y-axis > g.tick > text')
9595
.eq(0)
96-
.should('have.text', '−5.0k');
96+
.should('have.text', '−5k');
9797
});
9898

9999
it('non-Editable annotation is not draggable', () => {

packages/synchro-charts/cypress/integration/charts/line-chart/draggable-annotations.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ it('draggable annotation rescales axis in positive direction', () => {
220220
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
221221
cy.get('g.axis.y-axis > g.tick > text')
222222
.eq(16)
223-
.should('have.text', '9.0k');
223+
.should('have.text', '9k');
224224
cy.get('g.axis.y-axis > g.tick > text')
225225
.eq(0)
226-
.should('have.text', '1.0k');
226+
.should('have.text', '1k');
227227
});
228228

229229
it('draggable annotation rescales axis in negative direction', () => {
@@ -240,10 +240,10 @@ it('draggable annotation rescales axis in negative direction', () => {
240240
cy.get('g.axis.y-axis > g.tick').should('have.length', 10);
241241
cy.get('g.axis.y-axis > g.tick > text')
242242
.eq(9)
243-
.should('have.text', '5.0k');
243+
.should('have.text', '5k');
244244
cy.get('g.axis.y-axis > g.tick > text')
245245
.eq(0)
246-
.should('have.text', '−4.0k');
246+
.should('have.text', '−4k');
247247
});
248248

249249
it('non-Editable annotation is not draggable', () => {

packages/synchro-charts/cypress/integration/charts/scatter-chart/draggable-annotations.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ it('draggable annotation rescales axis in positive direction', () => {
104104
cy.get('g.axis.y-axis > g.tick').should('have.length', 17);
105105
cy.get('g.axis.y-axis > g.tick > text')
106106
.eq(16)
107-
.should('have.text', '9.0k');
107+
.should('have.text', '9k');
108108
cy.get('g.axis.y-axis > g.tick > text')
109109
.eq(0)
110-
.should('have.text', '1.0k');
110+
.should('have.text', '1k');
111111
});
112112

113113
it('draggable annotation rescales axis in negative direction', () => {
@@ -124,10 +124,10 @@ it('draggable annotation rescales axis in negative direction', () => {
124124
cy.get('g.axis.y-axis > g.tick').should('have.length', 10);
125125
cy.get('g.axis.y-axis > g.tick > text')
126126
.eq(9)
127-
.should('have.text', '5.0k');
127+
.should('have.text', '5k');
128128
cy.get('g.axis.y-axis > g.tick > text')
129129
.eq(0)
130-
.should('have.text', '−4.0k');
130+
.should('have.text', '−4k');
131131
});
132132

133133
it('non-Editable annotation is not draggable', () => {

packages/synchro-charts/cypress/support/commands.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { addChartCommands } from './chartCommands';
3030
addChartCommands();
3131

3232
addMatchImageSnapshotCommand({
33-
failureThresholdType: 'pixel',
34-
failureThreshold: 2,
33+
failureThresholdType: 'percent',
34+
failureThreshold: 0.01,
3535
customDiffConfig: { threshold: 0.2 },
3636
});

packages/synchro-charts/src/components/charts/sc-webgl-base-chart/renderAxis.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const yAxisConstructor = (size: SizeConfig, viewport: ViewPort) => {
7272

7373
return axisLeft(yScale)
7474
.ticks(yTickCount)
75-
.tickFormat(format('.2s'))
75+
.tickFormat(format('.4~s'))
7676
.tickSize(-size.width)
7777
.tickPadding(TICK_PADDING);
7878
};

packages/synchro-charts/src/components/charts/sc-webgl-base-chart/sc-webgl-axis.spec.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ describe('initial render', () => {
126126

127127
it('has expected y axis value labels', async () => {
128128
const { axis } = await axisSpecPage();
129-
expect(axis.innerHTML).toContain('3.0k');
129+
expect(axis.innerHTML).toContain('3k');
130+
expect(axis.innerHTML).toContain('3.05k');
130131
expect(axis.innerHTML).toContain('3.1k');
131-
expect(axis.innerHTML).not.toContain('3.00k');
132132
});
133133

134134
it('renders the y-axis label', async () => {
@@ -246,9 +246,9 @@ describe('updated correctly', () => {
246246
expect(axis.innerHTML).not.toContain('3.10k');
247247

248248
// Does contain new y labels
249-
expect(axis.innerHTML).toContain('4.0k');
249+
expect(axis.innerHTML).toContain('4k');
250250
expect(axis.innerHTML).toContain('4.5k');
251-
expect(axis.innerHTML).toContain('5.0k');
251+
expect(axis.innerHTML).toContain('5k');
252252
});
253253

254254
it('updates the y-axis label', async () => {

0 commit comments

Comments
 (0)