Skip to content

Commit c7b3d6c

Browse files
authored
Merge branch 'master' into 2020_11_25-rounded_line_joints
2 parents e2e859c + 8b167a4 commit c7b3d6c

6 files changed

Lines changed: 94 additions & 2 deletions
Loading
Loading

integration/tests/line_stories.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,16 @@ describe('Line series stories', () => {
6969
);
7070
});
7171
});
72+
73+
describe('Line with mark accessor', () => {
74+
it('with hidden points, default point highlighter size', async () => {
75+
await common.expectChartWithMouseAtUrlToMatchScreenshot(
76+
'http://localhost:9001/?path=/story/line-chart--line-with-mark-accessor&knob-markSizeRatio=10&knob-show line points=false&knob-debug=',
77+
{ left: 115, top: 170 },
78+
{
79+
screenshotSelector: '#story-root',
80+
},
81+
);
82+
});
83+
});
7284
});

src/chart_types/xy_chart/state/utils/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ function renderGeometries(
544544
xScaleOffset,
545545
lineSeriesStyle,
546546
{
547-
enabled: spec.markSizeAccessor !== undefined,
547+
enabled: spec.markSizeAccessor !== undefined && lineSeriesStyle.point.visible,
548548
ratio: chartTheme.markSizeRatio,
549549
},
550550
spec.pointStyleAccessor,
@@ -577,7 +577,7 @@ function renderGeometries(
577577
xScaleOffset,
578578
areaSeriesStyle,
579579
{
580-
enabled: spec.markSizeAccessor !== undefined,
580+
enabled: spec.markSizeAccessor !== undefined && areaSeriesStyle.point.visible,
581581
ratio: chartTheme.markSizeRatio,
582582
},
583583
spec.stackAccessors ? spec.stackAccessors.length > 0 : false,
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { number, boolean } from '@storybook/addon-knobs';
21+
import React from 'react';
22+
23+
import { Axis, Chart, Position, ScaleType, Settings, LineSeries } from '../../src';
24+
import { getRandomNumberGenerator } from '../../src/mocks/utils';
25+
26+
const rng = getRandomNumberGenerator();
27+
const bubbleData = new Array(30).fill(0).map((_, i) => ({
28+
x: i,
29+
y: rng(2, 3, 2),
30+
z: rng(0, 20),
31+
}));
32+
33+
export const Example = () => {
34+
const markSizeRatio = number('markSizeRatio', 10, {
35+
range: true,
36+
min: 1,
37+
max: 20,
38+
step: 1,
39+
});
40+
41+
const visible = boolean('show line points', true);
42+
43+
return (
44+
<Chart className="story-chart">
45+
<Settings
46+
showLegend
47+
theme={{
48+
markSizeRatio,
49+
lineSeriesStyle: {
50+
point: {
51+
visible,
52+
},
53+
},
54+
}}
55+
debug={boolean('debug', false)}
56+
/>
57+
<Axis id="bottom" position={Position.Bottom} title="Bottom axis" />
58+
<Axis
59+
id="left2"
60+
title="Left axis"
61+
position={Position.Left}
62+
tickFormat={(d) => Number(d).toFixed(2)}
63+
domain={{ max: 5 }}
64+
/>
65+
66+
<LineSeries
67+
id="lines"
68+
xScaleType={ScaleType.Linear}
69+
yScaleType={ScaleType.Linear}
70+
xAccessor="x"
71+
yAccessors={['y']}
72+
markSizeAccessor="z"
73+
data={bubbleData}
74+
/>
75+
</Chart>
76+
);
77+
};
78+
79+
Example.text = 'testing';

stories/line/line.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ export { Example as multiSeriesWithLogValues } from './9_multi_series';
3838
export { Example as discontinuousDataPoints } from './11_discontinuous_data_points';
3939
export { Example as testOrphanDataPoints } from './12_orphan_data_points';
4040
export { Example as testPathOrdering } from './10_test_path_ordering';
41+
export { Example as lineWithMarkAccessor } from './13_line_mark_accessor';

0 commit comments

Comments
 (0)