Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration validation #85

Open
3 tasks done
markov00 opened this issue Feb 28, 2019 · 1 comment
Open
3 tasks done

Add configuration validation #85

markov00 opened this issue Feb 28, 2019 · 1 comment
Labels
enhancement New feature or request :specs Chart specifications related issue

Comments

@markov00
Copy link
Member

markov00 commented Feb 28, 2019

Is your feature request related to a problem? Please describe.
Ensure a correct chart configuration for the developer

Describe the solution you'd like
Add a warning message on console if the chart doesn't respect a set of basic rules like:

  • avoid adding axes that are not related to configured series
  • avoid mixing series with different scale types
  • don't add a piechart together with a barseries
  • invalid accessors (for example, xAccessor={'foo'} when the data has no foo fields)

Prevent chart from not showing when config is bad, such as...

import React from 'react';

import { Chart, LineSeries, ScaleType, Position, Settings, Axis } from '../src';
import { SeededDataGenerator } from '../src/mocks/utils';

export class Playground extends React.Component<{}, { isSunburstShown: boolean }> {
  render() {
    const dg = new SeededDataGenerator();
    const data = dg.generateGroupedSeries(10, 2).map((item) => ({
      ...item,
      y1: item.y + 100,
    }));

    return (
      <>
        <div className="chart">
          <Chart>
            <Settings showLegend />
            <Axis id="y1" groupId="g1" position={Position.Left} title={'y1'} />
            <Axis id="y2" groupId="g2" position={Position.Left} title={'y2'} />
            <Axis id="x" position={Position.Bottom} title={'x'} />
            <LineSeries
              id={'aaa'}
              xScaleType={ScaleType.Linear}
              xAccessor={'x'}
              yAccessors={['y', 'y1']}
              splitSeriesAccessors={['g']}
              data={data}
            />
          </Chart>
        </div>
      </>
    );
  }
}

Describe alternatives you've considered
n/a

Additional context
n/a

Kibana Cross Issues
n/a
Checklist

  • this request is checked against already exist requests
  • every related Kibana issue is listed under Kibana Cross Issues list
  • kibana cross issue tag is associated to the issue if any kibana cross issue is present
@markov00 markov00 added the enhancement New feature or request label Feb 28, 2019
@markov00 markov00 mentioned this issue Feb 28, 2019
93 tasks
@markov00 markov00 added this to the 7.2 milestone Feb 28, 2019
@markov00 markov00 added the :specs Chart specifications related issue label Feb 28, 2019
@markov00 markov00 changed the title [specs] Add configuration validation Add configuration validation Feb 28, 2019
@emmacunningham
Copy link
Contributor

Maybe instead of throwing errors in the case of invalid custom domain specification, we can skip invalid configs (and just use the computed domain) and instead surface the invalid config as a warning also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request :specs Chart specifications related issue
Projects
None yet
Development

No branches or pull requests

2 participants