diff --git a/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js b/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js
index 37499b9728a..8418391dbcc 100644
--- a/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js
+++ b/src-docs/src/views/markdown_editor/markdown_editor_with_plugins.js
@@ -26,13 +26,14 @@ import {
EuiButtonEmpty,
EuiForm,
EuiFormRow,
- EuiSelect,
+ EuiColorPalettePicker,
EuiRange,
EuiText,
+ EuiFlexGroup,
+ EuiFlexItem,
} from '../../../../src/components';
import {
- euiPaletteColorBlind,
euiPaletteComplimentary,
euiPaletteCool,
euiPaletteForStatus,
@@ -44,7 +45,6 @@ import {
} from '../../../../src/services/color';
const paletteData = {
- euiPaletteColorBlind,
euiPaletteForStatus,
euiPaletteForTemperature,
euiPaletteComplimentary,
@@ -58,13 +58,13 @@ const paletteData = {
const paletteNames = Object.keys(paletteData);
const dg = new DataGenerator();
-const data = dg.generateGroupedSeries(20, 5);
+const generateData = categories => dg.generateGroupedSeries(10, categories);
const chartDemoPlugin = {
name: 'chartDemoPlugin',
button: {
label: 'Chart',
- iconType: 'visArea',
+ iconType: 'visBarVerticalStacked',
},
helpText: (
@@ -76,64 +76,69 @@ const chartDemoPlugin = {
Where options can contain:
-
- palette: A number between 1-9 for each palette.
+ palette: A number between 1-8 for each palette.
-
- height:
- The height of the chart
+ categories:
+ The number of categories per column
),
editor: function ChartEditor({ node, onSave, onCancel }) {
- const [palette, setPalette] = useState((node && node.palette) || 4);
- const [height, setHeight] = useState((node && node.height) || 300);
+ const [palette, setPalette] = useState((node && node.palette) || '1');
+ const [categories, setCategories] = useState(5);
+
+ const onChange = e => {
+ setCategories(parseInt(e.target.value));
+ };
+
+ const palettes = paletteNames.map((paletteName, index) => {
+ return {
+ value: String(index + 1),
+ title: paletteName,
+ palette: paletteData[paletteNames[index]](categories),
+ type: 'fixed',
+ };
+ });
return (
<>
- Chart data
+ Add chart
<>
-
-
- setPalette(parseInt(e.currentTarget.value, 10))
- }
- />
-
-
-
- setHeight(parseInt(e.currentTarget.value, 10))}
- />
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
>
@@ -142,7 +147,7 @@ const chartDemoPlugin = {
- onSave(`!{chart${JSON.stringify({ palette, height })}}`, {
+ onSave(`!{chart${JSON.stringify({ palette, categories })}}`, {
block: true,
})
}
@@ -211,6 +216,7 @@ function ChartMarkdownParser() {
}
match += '}';
+
return eat(match)({
type: 'chartDemoPlugin',
...configuration,
@@ -221,14 +227,15 @@ function ChartMarkdownParser() {
methods.splice(methods.indexOf('text'), 0, 'chart');
}
-const ChartMarkdownRenderer = ({ height = 200, palette = 5 }) => {
+// receives the configuration from the parser and renders
+const ChartMarkdownRenderer = ({ palette, categories }) => {
const customColors = {
colors: {
- vizColors: paletteData[paletteNames[palette]](5),
+ vizColors: paletteData[paletteNames[palette - 1]](categories),
},
};
return (
-
+
{
{