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

Legend value for null series value #351

Closed
2 tasks done
nickofthyme opened this issue Aug 26, 2019 · 3 comments
Closed
2 tasks done

Legend value for null series value #351

nickofthyme opened this issue Aug 26, 2019 · 3 comments
Labels
bug Something isn't working :legend Legend related issue

Comments

@nickofthyme
Copy link
Collaborator

Describe the bug
When hovering over a split group, if a given series in the legend does not have a value for that split group, the last value will show is the legend only for that series, and others with no values too. This results in a possible mixture of last and current values.

Also if a series does not have a "last" value the closest to last value is used, making the value entirely confusing!

To Reproduce
Steps to reproduce the behavior:

  1. Create BarSeries
// playground.tsx
import React from 'react';

import { Axis, Chart, getAxisId, getSpecId, niceTimeFormatter, Position, ScaleType, Settings, BarSeries } from '../src';
import { KIBANA_METRICS } from '../src/utils/data_samples/test_dataset_kibana';
import { CursorEvent } from '../src/specs/settings';
import { CursorUpdateListener } from '../src/chart_types/xy_chart/store/chart_state';

const DATA = [
  {
    'extension.keyword': '',
    'geo.src': 'IN',
    count: 23,
  },
  {
    'extension.keyword': '',
    'geo.src': 'CN',
    count: 17,
  },
  {
    'extension.keyword': '',
    'geo.src': 'US',
    count: 6,
  },
  {
    'extension.keyword': '',
    'geo.src': 'BR',
    count: 3,
  },
  {
    'extension.keyword': '',
    'geo.src': 'FR',
    count: 3,
  },
  {
    'extension.keyword': 'gz',
    'geo.src': 'CN',
    count: 9,
  },
  {
    'extension.keyword': 'gz',
    'geo.src': 'US',
    count: 5,
  },
  {
    'extension.keyword': 'gz',
    'geo.src': 'IN',
    count: 4,
  },
  {
    'extension.keyword': 'gz',
    'geo.src': 'BD',
    count: 3,
  },
  {
    'extension.keyword': 'gz',
    'geo.src': 'AR',
    count: 2,
  },
  {
    'extension.keyword': 'css',
    'geo.src': 'CN',
    count: 7,
  },
  {
    'extension.keyword': 'css',
    'geo.src': 'VE',
    count: 3,
  },
  {
    'extension.keyword': 'css',
    'geo.src': 'IN',
    count: 2,
  },
  {
    'extension.keyword': 'css',
    'geo.src': 'US',
    count: 2,
  },
  {
    'extension.keyword': 'css',
    'geo.src': 'AF',
    count: 1,
  },
  {
    'extension.keyword': 'zip',
    'geo.src': 'CN',
    count: 8,
  },
  {
    'extension.keyword': 'zip',
    'geo.src': 'IN',
    count: 7,
  },
  {
    'extension.keyword': 'zip',
    'geo.src': 'US',
    count: 4,
  },
  {
    'extension.keyword': 'zip',
    'geo.src': 'PH',
    count: 2,
  },
  {
    'extension.keyword': 'zip',
    'geo.src': 'BD',
    count: 1,
  },
  {
    'extension.keyword': 'deb',
    'geo.src': 'CN',
    count: 5,
  },
  {
    'extension.keyword': 'deb',
    'geo.src': 'SA',
    count: 3,
  },
  {
    'extension.keyword': 'deb',
    'geo.src': 'IT',
    count: 2,
  },
  {
    'extension.keyword': 'deb',
    'geo.src': 'PK',
    count: 2,
  },
  {
    'extension.keyword': 'deb',
    'geo.src': 'CG',
    count: 1,
  },
];

export class Playground extends React.Component {
  render() {
    return (
      <Chart>
        <Settings tooltip={{ type: 'vertical' }} debug={false} legendPosition={Position.Right} showLegend />
        <Axis id={getAxisId('timestamp')} title="timestamp" position={Position.Bottom} />
        <Axis id={getAxisId('count')} title="count" position={Position.Left} tickFormat={(d) => d.toFixed(2)} />
        <BarSeries
          id={getSpecId('Testing')}
          xScaleType={ScaleType.Ordinal}
          yScaleType={ScaleType.Log}
          data={DATA}
          xAccessor="extension.keyword"
          yAccessors={['count']}
          splitSeriesAccessors={['geo.src']}
        />
      </Chart>
    );
  }
}
  1. Hover over the first bucket
  2. Notice the legend value of AR is 2.00 which AR has no value for the first bucket.

Expected behavior
The current value should always be shown and if there is no current value a - (dash) or similar should be used to indicate the absence of a value.

Screenshots
image

Kibana Cross Issues
Add any Kibana related issues here.

Checklist

  • 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
@nickofthyme nickofthyme added bug Something isn't working :legend Legend related issue labels Aug 26, 2019
@markov00
Copy link
Member

markov00 commented Aug 27, 2019

That should be already fixed in the last master version 11.0.3
@nickofthyme could you check? I'm pretty sure it's fixed

@nickofthyme
Copy link
Collaborator Author

Ok let me check.

@nickofthyme
Copy link
Collaborator Author

@markov00 You are correct! I still think the mixed values for the "last" value is problematic so I commented on the discuss ticket #246 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working :legend Legend related issue
Projects
None yet
Development

No branches or pull requests

2 participants