Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/chart/line/LineView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {ECPolyline, ECPolygon} from './poly';
import ChartView from '../../view/Chart';
import {prepareDataCoordInfo, getStackedOnPoint} from './helper';
import {createGridClipPath, createPolarClipPath} from '../helper/createClipPathFromCoordSys';
import LineSeriesModel, { LineEndLabelOption, LineSeriesOption } from './LineSeries';
import LineSeriesModel, { LineSeriesOption } from './LineSeries';
import type GlobalModel from '../../model/Global';
import type ExtensionAPI from '../../core/ExtensionAPI';
// TODO
Expand Down Expand Up @@ -59,11 +59,16 @@ import { convertToColorString } from '../../util/format';

type PolarArea = ReturnType<Polar['getArea']>;
type Cartesian2DArea = ReturnType<Cartesian2D['getArea']>;

interface SymbolExtended extends SymbolClz {
__temp: boolean
}

interface ColorStop {
offset: number
coord?: number
color: ColorString
}

function isPointsSame(points1: ArrayLike<number>, points2: ArrayLike<number>) {
if (points1.length !== points2.length) {
return;
Expand Down Expand Up @@ -233,17 +238,17 @@ function getVisualGradient(
// LinearGradient to render `outerColors`.

const axis = coordSys.getAxis(coordDim);
const axisScaleExtent = axis.scale.getExtent();

interface ColorStop {
offset: number
coord?: number
color: ColorString
}
// dataToCoord mapping may not be linear, but must be monotonic.
const colorStops: ColorStop[] = zrUtil.map(visualMeta.stops, function (stop) {
let coord = axis.toGlobalCoord(axis.dataToCoord(stop.value));
// normalize the infinite value
isNaN(coord) || isFinite(coord)
Comment thread
plainheart marked this conversation as resolved.
|| (coord = axis.toGlobalCoord(axis.dataToCoord(axisScaleExtent[+(coord < 0)])));
return {
offset: 0,
coord: axis.toGlobalCoord(axis.dataToCoord(stop.value, true)),
coord,
color: stop.color
};
});
Expand Down
177 changes: 160 additions & 17 deletions test/linear-gradient.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.