Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
items: [{ color: 'red', text: 'weweyang: 12' }, { color: 'blue', text: 'timqian: 13' }],
position: { x: 30, y: 30, type: config.positionType.upRight },
unxkcdify: this.options.unxkcdify,
backgroundColor: this.options.backgroundColor,
strokeColor: this.options.strokeColor,
});
const xScale = scaleBand()
.range([0, this.width])
.domain(this.data.labels)
.padding(0.4);
const allData = this.data.datasets
.reduce((pre, cur) => pre.concat(cur.data), []);
const yScale = scaleLinear()
.domain([0, Math.max(...allData)])
.range([this.height, 0]);
const graphPart = this.chart.append('g');
// axis
addAxis.xAxis(graphPart, {
xScale,
tickCount: 3,
moveDown: this.height,
fontFamily: this.fontFamily,
unxkcdify: this.options.unxkcdify,
stroke: this.options.strokeColor,
});
addAxis.yAxis(graphPart, {
yScale,
position: { x: 0, y: 0, type: config.positionType.downRight },
unxkcdify: this.options.unxkcdify,
strokeColor: this.options.strokeColor,
backgroundColor: this.options.backgroundColor,
});
const dotInitSize = 3.5 * (this.options.dotSize || 1);
const dotHoverSize = 6 * (this.options.dotSize || 1);
const radius = Math.min(this.width, this.height) / 2 - margin;
const angleStep = (Math.PI * 2) / this.directionsCount;
const allDataValues = this.data.datasets
.reduce((acc, cur) => acc.concat(cur.data), []);
const maxValue = Math.max(...allDataValues);
const allMaxData = Array(this.directionsCount).fill(maxValue);
const valueScale = scaleLinear()
.domain([0, maxValue])
.range([0, radius]);
const getX = (d, i) => valueScale(d) * Math.cos(angleStep * i + angleOffset);
const getY = (d, i) => valueScale(d) * Math.sin(angleStep * i + angleOffset);
const theLine = line()
.x(getX)
.y(getY)
.curve(curveLinearClosed);
// grid
const ticks = valueScale.ticks(this.options.ticksCount || 3);
const grid = this.chart.append('g')
.attr('class', 'xkcd-chart-radar-grid')
.attr('stroke-width', '1')
.attr('filter', this.filter);
items: [{ color: 'red', text: 'weweyang: 12' }, { color: 'blue', text: 'timqian: 13' }],
position: { x: 30, y: 30, type: config.positionType.upRight },
unxkcdify: this.options.unxkcdify,
backgroundColor: this.options.backgroundColor,
strokeColor: this.options.strokeColor,
});
const xScale = scaleBand()
.range([0, this.width])
.domain(this.data.labels)
.padding(0.4);
const allCols = this.data.datasets
.reduce((r, a) => a.data.map((b, i) => (r[i] || 0) + b), []);
const yScale = scaleLinear()
.domain([0, Math.max(...allCols)])
.range([this.height, 0]);
const graphPart = this.chart.append('g');
// axis
addAxis.xAxis(graphPart, {
xScale,
tickCount: 3,
moveDown: this.height,
fontFamily: this.fontFamily,
unxkcdify: this.options.unxkcdify,
stroke: this.options.strokeColor,
});
addAxis.yAxis(graphPart, {
yScale,
if (this.options.timeFormat) {
this.data.datasets.forEach((dataset) => {
dataset.data.forEach((d) => {
// eslint-disable-next-line no-param-reassign
d.x = dayjs(d.x);
});
});
}
const allData = this.data.datasets
.reduce((pre, cur) => pre.concat(cur.data), []);
const allDataX = allData.map((d) => d.x);
const allDataY = allData.map((d) => d.y);
let xScale = scaleLinear()
.domain([Math.min(...allDataX), Math.max(...allDataX)])
.range([0, this.width]);
if (this.options.timeFormat) {
xScale = scaleTime()
.domain([Math.min(...allDataX), Math.max(...allDataX)])
.range([0, this.width]);
}
const yScale = scaleLinear()
.domain([Math.min(...allDataY), Math.max(...allDataY)])
.range([this.height, 0]);
const graphPart = this.chart.append('g')
.attr('pointer-events', 'all');
title: '',
items: [{ color: 'red', text: 'weweyang' }, { color: 'blue', text: 'timqian' }],
position: { x: 60, y: 60, type: config.positionType.downRight },
unxkcdify: this.options.unxkcdify,
backgroundColor: this.options.backgroundColor,
strokeColor: this.options.strokeColor,
});
const xScale = scalePoint()
.domain(this.data.labels)
.range([0, this.width]);
const allData = this.data.datasets
.reduce((pre, cur) => pre.concat(cur.data), []);
const yScale = scaleLinear()
.domain([Math.min(...allData), Math.max(...allData)])
.range([this.height, 0]);
const graphPart = this.chart.append('g')
.attr('pointer-events', 'all');
// axis
addAxis.xAxis(graphPart, {
xScale,
tickCount: 3,
moveDown: this.height,
fontFamily: this.fontFamily,
unxkcdify: this.options.unxkcdify,
stroke: this.options.strokeColor,
});
addAxis.yAxis(graphPart, {
constructor(props) {
super(props)
this.slider = null
this.handles = {}
this.valueToPerc = scaleLinear()
this.valueToStep = scaleQuantize()
this.pixelToStep = scaleQuantize()
this.state = { values: [] }
this.onMouseMove = this.onMouseMove.bind(this)
this.onTouchMove = this.onTouchMove.bind(this)
this.onMove = this.onMove.bind(this)
this.onMouseDown = this.onMouseDown.bind(this)
this.onTouchStart = this.onTouchStart.bind(this)
this.onStart = this.onStart.bind(this)
this.onMouseUp = this.onMouseUp.bind(this)
this.onTouchEnd = this.onTouchEnd.bind(this)
}
);
}
if (!subjectsLoaded || !data || !data.length) {
return null;
}
let fullData = data;
data = data.filter(d => !excluding[d.groupId]);
width = Math.min(width, data.length * 110 + 60);
let dataValues = data.map(({ count }) => count);
let displayValues = data.map(({ display }) => display);
let chartHeight = height - margin.top - margin.bottom;
let dataMax = max(dataValues);
let dataScale = scaleLinear()
.domain([0, dataMax])
.range([0, chartHeight]);
let scaleX = scaleBand()
.domain(displayValues)
.range([0, width])
.paddingInner([0.1])
.paddingOuter([0.3])
.align([0.5]);
let svgStyle = { display: "block", marginLeft: "auto", marginRight: "auto" }; //, marginLeft: 'auto', marginRight: 'auto'};
let excludedCount = Object.keys(excluding).filter(k => excluding[k]).length;
return (
<div> {
this.topRef(el);
this.el = el;</div>
yScale() {
return scaleLinear()
.range([this.nheight, 0])
.domain([0, Math.max(...this.allData)])
}
},