# 数据抽取

¥Data Decimation

抽取插件可与折线图一起使用,以在图表生命周期开始时自动抽取数据。在启用此插件之前,请查看 requirements 以确保它适用于你要创建的图表。

¥The decimation plugin can be used with line charts to automatically decimate data at the start of the chart lifecycle. Before enabling this plugin, review the requirements to ensure that it will work with the chart you want to create.

# 配置选项

¥Configuration Options

命名空间:options.plugins.decimation,插件的全局选项在 Chart.defaults.plugins.decimation 中定义。

¥Namespace: options.plugins.decimation, the global options for the plugin are defined in Chart.defaults.plugins.decimation.

名称 类型 默认 描述
enabled boolean false 是否启用抽取?
algorithm string 'min-max' 要使用的抽取算法。见 更多...
samples number 如果使用 'lttb' 算法,则这是输出数据集中的样本数。默认为画布宽度,每个像素选取 1 个样本。
threshold number 如果当前坐标轴范围内的样本数量高于此值,将触发抽取。默认为画布宽度的4倍。
抽取后的点数可以高于threshold值。

# 抽取算法

¥Decimation Algorithms

用于数据的抽取算法。选项是:

¥Decimation algorithm to use for data. Options are:

  • 'lttb'

  • 'min-max'

# 最大三角三桶 (LTTB) 抽取

¥Largest Triangle Three Bucket (LTTB) Decimation

LTTB (opens new window) 抽取显着减少了数据点的数量。这对于仅使用少数数据点显示数据趋势最为有用。

¥LTTB (opens new window) decimation reduces the number of data points significantly. This is most useful for showing trends in data using only a few data points.

# 最小/最大抽取

¥Min/Max Decimation

最小/最大 (opens new window) 抽取将保留数据中的峰值,但每个像素最多可能需要 4 个点。这种类型的抽取适用于需要查看数据峰值的非常嘈杂的信号。

¥Min/max (opens new window) decimation will preserve peaks in your data but could require up to 4 points for each pixel. This type of decimation would work well for a very noisy signal where you need to see data peaks.

# 要求

¥Requirements

要使用抽取插件,必须满足以下要求:

¥To use the decimation plugin, the following requirements must be met:

  1. 数据集必须具有 'x'indexAxis

    ¥The dataset must have an indexAxis of 'x'

  2. 数据集必须是一条线

    ¥The dataset must be a line

  3. 数据集的 X 轴必须是 'linear''time' 类型的轴

    ¥The X axis for the dataset must be either a 'linear' or 'time' type axis

  4. 数据必须不需要解析,即 parsing 必须是 false

    ¥Data must not need parsing, i.e. parsing must be false

  5. 数据集对象必须是可变的。该插件将原始数据存储为 dataset._data,然后在数据集上定义一个新的 data 属性。

    ¥The dataset object must be mutable. The plugin stores the original data as dataset._data and then defines a new data property on the dataset.

  6. 图表上的点数必须多于阈值。查看配置选项以获取更多信息。

    ¥There must be more points on the chart than the threshold value. Take a look at the Configuration Options for more information.

# 相关样品

¥Related Samples