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

Update dependency @elastic/charts to v23.0.0 #79226

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

nickofthyme
Copy link
Contributor

@nickofthyme nickofthyme commented Oct 1, 2020

Summary

This PR contains the following updates:

Package Type Update Change
@elastic/charts dependencies major 21.1.2 -> 23.0.0

Fixes accidental breaking change in v21.1.1 see elastic/elastic-charts#830

Note on BREAKING CHANGES for Reviewers

There is just a main breaking change from the previous version and you can encounter it only if you use the headerFormatter to change the formatting of the tooltip header.
The breaking change is the following: the TooltipValue.value is now raw value (not formatted with the X axis configured tick formatter) and TooltipValue.formattedValue is now the actual formatted value.

Release Notes

elastic/elastic-charts

23.0.0 (2020-09-30)

Bug Fixes

  • render continuous line/area between non-adjacent points (#833) (9f9892b), closes #825

Features

  • debug state flag added to chart status (#834) (83919ff)
  • expose datum as part of GeometryValue (#822) (dcd7077)

BREAKING CHANGES

  • when rendering non-stacked line/area charts with a continuous x scale and no fit function,
    the line/area between non-consecutive data points will be rendered as a continuous line/area without adding an uncertain dashed line/ semi-transparent area that connects the two, non-adjacent, points.

22.0.0 (2020-09-22)

Bug Fixes

  • breaking change in patch release of 21.1.1 (d0ddc45), closes #830
  • legend dark mode hover color (#820) (5227b2e)
  • line path with ordered xValues (#824) (5a73a3a)
  • axis: style overrides not applied to axis dimensions (#829) (62172c4)
  • remove unused redux dev middlewares (#812) (b2679e7)
  • build issues and tooltip formatting issues (#810) (74d9ae0)

Features

BREAKING CHANGES


@elastic/charts update procedure

Checklist

Delete any items that are not applicable to this PR.

@nickofthyme nickofthyme requested a review from a team as a code owner October 1, 2020 21:56
@nickofthyme nickofthyme added dependencies Pull requests that update a dependency file release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Oct 1, 2020
Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nickofthyme
Copy link
Contributor Author

nickofthyme commented Oct 1, 2020

The type errors seem unrealated 🤔

ERROR x-pack failed
      x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts:81:36 - error TS2339: Property 'partition_field_name' does not exist on type '{ detector_description: string; function: string; field_name: string; }'.

      81       analysis_config.detectors[0].partition_field_name = partitionField;
                                            ~~~~~~~~~~~~~~~~~~~~

      x-pack/plugins/infra/public/containers/ml/modules/metrics_hosts/module_descriptor.ts:118:36 - error TS2339: Property 'aggregations' does not exist on type '{ job_id: string; indices: string[]; indices_options: { allow_no_indices: boolean; }; query: { bool: { must: { exists: { field: string; }; }[]; }; }; } | { job_id: string; indices: string[]; indices_options: { ...; }; query: { ...; }; chunking_config: { ...; }; aggregations: { ...; }; } | { ...; }'.
        Property 'aggregations' does not exist on type '{ job_id: string; indices: string[]; indices_options: { allow_no_indices: boolean; }; query: { bool: { must: { exists: { field: string; }; }[]; }; }; }'.

      118           ...defaultDatafeedConfig.aggregations,
                                             ~~~~~~~~~~~~

      x-pack/plugins/infra/public/containers/ml/modules/metrics_k8s/module_descriptor.ts:113:29 - error TS2339: Property 'aggregations' does not exist on type '{ job_id: string; indices: string[]; indices_options: { allow_no_indices: boolean; }; query: { bool: { must: { exists: { field: string; }; }[]; }; }; } | { job_id: string; indices: string[]; indices_options: { ...; }; query: { ...; }; chunking_config: { ...; }; aggregations: { ...; }; } | { ...; }'.
        Property 'aggregations' does not exist on type '{ job_id: string; indices: string[]; indices_options: { allow_no_indices: boolean; }; query: { bool: { must: { exists: { field: string; }; }[]; }; }; }'.

      113       defaultDatafeedConfig.aggregations[DEFAULT_K8S_PARTITION_FIELD].aggregations;
                                      ~~~~~~~~~~~~


      Found 3 errors.

@markov00
Copy link
Member

markov00 commented Oct 2, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

@kbn/ui-shared-deps asset size

id before after diff
kbn-ui-shared-deps.@elastic.js 2.9MB 2.9MB +8.3KB
kbn-ui-shared-deps.js 5.2MB 5.2MB +8.0B
total +8.3KB

distributable file count

id before after diff
default 45825 45832 +7
oss 26530 26537 +7

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@markov00
Copy link
Member

markov00 commented Oct 2, 2020

@shahzad31 I'd like to have your review on the tooltip header used in the following file:

const headerFormatter: TooltipValueFormatter = (tooltip: TooltipValue) => {
return (
<div>
<p>
{tooltip.value} {I18LABELS.seconds}
</p>
</div>
);
};

We changed the current format of the TooltipValue with:

TooltipValue.value is now raw value and TooltipValue.formattedValue is now the
string formatted value.
could you please check if that alter your current chart?

Also note that this update fixes the issues you have reported here: elastic/elastic-charts#825

@markov00
Copy link
Member

markov00 commented Oct 2, 2020

@flash1293 I want to point your attention to this code here, can you please check if that upgrade doesn't affect that?

tooltip={{
headerFormatter: (d) => safeXAccessorLabelRenderer(d.value),
}}

@markov00
Copy link
Member

markov00 commented Oct 2, 2020

@peteharverson could you please review this dependency upgrade and in particular if the mentioned breaking changes affect this part of your code:

const headerFormatter: TooltipValueFormatter = (tooltipData: ChartTooltipValue) => {
const xValue = tooltipData.value;
const chartPoint: MetricDistributionChartData | undefined = chartData.find(
(data) => data.x === xValue
);
return (
<MetricDistributionChartTooltipHeader
chartPoint={chartPoint}
maxWidth={width / 2}
fieldFormat={fieldFormat}
/>
);
};

@dej611
Copy link
Contributor

dej611 commented Oct 2, 2020

@markov00 on the Lens side it's ok that line as we convert the particular case to string before to give it to the chart. The value and formattedValue is the same content for now. No breaking changes. (Tested locally already)

@shahzad31
Copy link
Contributor

@markov00 fix for elastic/elastic-charts#825 seems to be working great

@shahzad31
Copy link
Contributor

Though tooltip formatting is gone
Uploading image.png…

@markov00
Copy link
Member

markov00 commented Oct 2, 2020

@shahzad31 probably this is the right image (your seems not being uploaded completely)
image (1)

I think the issue here is that you are using the labelFormat in the Y Axis component and using the tickFormat only on the Overall LineSeries. The other lines are not receiving the formatted because of that.
The possible way to fix this is:

  • switch the Y Axis formatter to the tickFormat prop instead of the labelFormat
  • add a tickFormat for every BreakdownSeries series
 <Axis
            id="left"
            title={I18LABELS.percPageLoaded}
            position={Position.Left}
            labelFormat={(d) => d + ' %'} <---- this formatter is used only for the axis, not for the series, use tickFormat instead
          />
          <LineSeries
            sortIndex={0}
            fit={Fit.Linear}
            id={'PagesPercentage'}
            name={I18LABELS.overall}
            xScaleType={ScaleType.Linear}
            yScaleType={ScaleType.Linear}
            data={data?.pageLoadDistribution ?? []}
            curve={CurveType.CURVE_CATMULL_ROM}
            lineSeriesStyle={{
              point: { visible: false },
              line: { strokeWidth: 3 },
            }}
            color={euiChartTheme.theme.colors?.vizColors?.[1]}
            tickFormat={(d) => numeral(d).format('0.0') + ' %'} <--- this is series specific
          />
          {breakdown && (
            <BreakdownSeries.  <---- this component, internally doesn't have any formatter
              key={`${breakdown.type}-${breakdown.name}`}
              field={breakdown.type}
              value={breakdown.name}
              percentileRange={percentileRange}
              onLoadingChange={(bLoading) => {
                setBreakdownLoading(bLoading);
              }}
            />
          )}

Update
looking at the screenshot, the best approach is to add the tickFormat to the BreakdownSeries as you are using a different formatted for the axis and for the series (you are limiting the number of decimal points only on the series data)

This is not a breaking change introduced with this PR, but it was already there since version 21.1.0

@darnautov
Copy link
Contributor

Tested and LGTM
image

@markov00 markov00 merged commit e9fd390 into elastic:master Oct 2, 2020
markov00 added a commit that referenced this pull request Oct 2, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Nick Partridge <nick.ryan.partridge@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@nickofthyme nickofthyme deleted the upgrade-elastic-charts branch October 2, 2020 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking change between 21.1.0 and 21.3.2 Line series with different x values are hidden
8 participants