+ You can omit width and/or height
+ prop and the chart takes the full width and/or height of it's parent.
+
+
The parent container needs to have computed a height and/or width.
),
+ source: [
+ {
+ type: GuideSectionTypes.JS,
+ code: require('!!raw-loader!./responsive_chart'),
+ },
+ {
+ type: GuideSectionTypes.HTML,
+ code: 'This component can only be used from React',
+ },
+ ],
+ demo: ,
},
// TODO include the following example when AreasSeries PR (create vertical areachart)
// will be merged into react-vis and orientation prop semantic will be solved.
diff --git a/src-docs/src/views/xy_chart_area/area_example.js b/src-docs/src/views/xy_chart_area/area_example.js
index ac270fb357a..1c8fd07c642 100644
--- a/src-docs/src/views/xy_chart_area/area_example.js
+++ b/src-docs/src/views/xy_chart_area/area_example.js
@@ -46,11 +46,7 @@ export const XYChartAreaExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Stacked Area Series',
@@ -74,11 +70,7 @@ export const XYChartAreaExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Curved Area Series',
@@ -104,11 +96,7 @@ export const XYChartAreaExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Range area chart',
@@ -129,11 +117,7 @@ export const XYChartAreaExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
],
};
diff --git a/src-docs/src/views/xy_chart_axis/xy_axis_example.js b/src-docs/src/views/xy_chart_axis/xy_axis_example.js
index ddb83096a26..0777341a681 100644
--- a/src-docs/src/views/xy_chart_axis/xy_axis_example.js
+++ b/src-docs/src/views/xy_chart_axis/xy_axis_example.js
@@ -46,11 +46,7 @@ export const XYChartAxisExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Annotations',
@@ -73,11 +69,7 @@ export const XYChartAxisExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
],
};
diff --git a/src-docs/src/views/xy_chart_bar/bar_example.js b/src-docs/src/views/xy_chart_bar/bar_example.js
index 7c3c02dc9fd..e23e146dbeb 100644
--- a/src-docs/src/views/xy_chart_bar/bar_example.js
+++ b/src-docs/src/views/xy_chart_bar/bar_example.js
@@ -91,7 +91,7 @@ export const XYChartBarExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Stacked Vertical Bar Chart',
@@ -113,7 +113,7 @@ export const XYChartBarExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Horizontal Bar Chart',
@@ -138,7 +138,7 @@ export const XYChartBarExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Stacked Horizontal Bar Chart',
@@ -163,7 +163,7 @@ export const XYChartBarExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
@@ -185,7 +185,7 @@ export const XYChartBarExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
],
};
diff --git a/src-docs/src/views/xy_chart_histogram/histogram_example.js b/src-docs/src/views/xy_chart_histogram/histogram_example.js
index 520fc0f07fe..ac1af3a16b9 100644
--- a/src-docs/src/views/xy_chart_histogram/histogram_example.js
+++ b/src-docs/src/views/xy_chart_histogram/histogram_example.js
@@ -89,7 +89,7 @@ export const XYChartHistogramExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Stacked Vertical Histogram',
@@ -121,7 +121,7 @@ export const XYChartHistogramExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Horizontal Histogram',
@@ -144,7 +144,7 @@ export const XYChartHistogramExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Stacked Horizontal Histogram',
@@ -175,7 +175,7 @@ export const XYChartHistogramExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
{
title: 'Time Series Histogram version',
@@ -196,7 +196,7 @@ export const XYChartHistogramExample = {
code: 'This component can only be used from React',
},
],
- demo: (),
+ demo: ,
},
],
};
diff --git a/src-docs/src/views/xy_chart_histogram/time_histogram_series.js b/src-docs/src/views/xy_chart_histogram/time_histogram_series.js
index 83317b3288f..d51c081c786 100644
--- a/src-docs/src/views/xy_chart_histogram/time_histogram_series.js
+++ b/src-docs/src/views/xy_chart_histogram/time_histogram_series.js
@@ -13,7 +13,12 @@ import {
const { SCALE } = EuiXYChartUtils;
const timestamp = Date.now();
const ONE_HOUR = 3600000;
-
+const margins = {
+ top: 10,
+ left: 80,
+ right: 0,
+ bottom: 20,
+};
function randomizeData(size = 24, max = 15) {
return new Array(size)
@@ -50,7 +55,7 @@ export default class Example extends Component {
Randomize data
-
+
{data.map((d, i) => )}
diff --git a/src-docs/src/views/xy_chart_line/line_example.js b/src-docs/src/views/xy_chart_line/line_example.js
index a3104023925..1d4a31048a8 100644
--- a/src-docs/src/views/xy_chart_line/line_example.js
+++ b/src-docs/src/views/xy_chart_line/line_example.js
@@ -48,11 +48,7 @@ export const XYChartLineExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Custom domain line chart',
@@ -76,11 +72,7 @@ export const XYChartLineExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Multi Line chart',
@@ -102,11 +94,7 @@ export const XYChartLineExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Curved Line chart',
@@ -132,11 +120,7 @@ export const XYChartLineExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
{
title: 'Custom style Line chart',
@@ -170,11 +154,7 @@ export const XYChartLineExample = {
code: 'This component can only be used from React',
},
],
- demo: (
-
-
-
- ),
+ demo: ,
},
],
};
diff --git a/src/components/xy_chart/_xy_chart.scss b/src/components/xy_chart/_xy_chart.scss
index 121a7a16e9c..7017226e452 100644
--- a/src/components/xy_chart/_xy_chart.scss
+++ b/src/components/xy_chart/_xy_chart.scss
@@ -1,3 +1,4 @@
-.rv-xy-plot__inner {
- overflow: visible; // TODO fix when adding automatic margin into svg
+.rv-xy-plot {
+ width: 100% !important; // this because react-vis fix the width of the container in px
+ height: 100% !important; // avoid a correct computation of the component size
}
diff --git a/src/components/xy_chart/axis/__snapshots__/default_axis.test.js.snap b/src/components/xy_chart/axis/__snapshots__/default_axis.test.js.snap
index cb03e4c7653..98d6cede4cf 100644
--- a/src/components/xy_chart/axis/__snapshots__/default_axis.test.js.snap
+++ b/src/components/xy_chart/axis/__snapshots__/default_axis.test.js.snap
@@ -16,6 +16,7 @@ exports[`EuiDefaultAxis render default axis 1`] = `