fix(radar): angle arc colors
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "aoe_technology_radar",
|
"name": "aoe_technology_radar",
|
||||||
"version": "3.3.4",
|
"version": "3.4.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "aoe_technology_radar",
|
"name": "aoe_technology_radar",
|
||||||
"version": "3.3.4",
|
"version": "3.4.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apideck/better-ajv-errors": "0.3.6",
|
"@apideck/better-ajv-errors": "0.3.6",
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ import React from "react";
|
|||||||
import { ConfigData } from "../../config";
|
import { ConfigData } from "../../config";
|
||||||
import { QuadrantConfig } from "../../model";
|
import { QuadrantConfig } from "../../model";
|
||||||
|
|
||||||
|
const arcAngel = [
|
||||||
|
[(3 * Math.PI) / 2, (4 * Math.PI) / 2],
|
||||||
|
[0, Math.PI / 2],
|
||||||
|
[Math.PI, Math.PI * 3 / 2],
|
||||||
|
[Math.PI / 2, Math.PI],
|
||||||
|
];
|
||||||
|
|
||||||
function arcPath(
|
function arcPath(
|
||||||
quadrantPosition: number,
|
quadrantPosition: number,
|
||||||
ringPosition: number,
|
ringPosition: number,
|
||||||
xScale: d3.ScaleLinear<number, number>,
|
xScale: d3.ScaleLinear<number, number>,
|
||||||
config: ConfigData
|
config: ConfigData
|
||||||
) {
|
) {
|
||||||
const startAngle =
|
const [startAngle, endAngle] = arcAngel[quadrantPosition - 1];
|
||||||
quadrantPosition === 1
|
|
||||||
? (3 * Math.PI) / 2
|
|
||||||
: ((quadrantPosition - 2) * Math.PI) / 2;
|
|
||||||
const endAngle =
|
|
||||||
quadrantPosition === 1
|
|
||||||
? (4 * Math.PI) / 2
|
|
||||||
: ((quadrantPosition - 1) * Math.PI) / 2;
|
|
||||||
const arcAttrs = config.chartConfig.ringsAttributes[ringPosition],
|
const arcAttrs = config.chartConfig.ringsAttributes[ringPosition],
|
||||||
ringRadiusPx = xScale(arcAttrs.radius) - xScale(0),
|
ringRadiusPx = xScale(arcAttrs.radius) - xScale(0),
|
||||||
arc = d3.arc();
|
arc = d3.arc();
|
||||||
@@ -41,8 +41,8 @@ const QuadrantRings: React.FC<{
|
|||||||
const gradientAttributes = [
|
const gradientAttributes = [
|
||||||
{ x: 0, y: 0, cx: 1, cy: 1, r: 1 },
|
{ x: 0, y: 0, cx: 1, cy: 1, r: 1 },
|
||||||
{ x: xScale(0), y: 0, cx: 0, cy: 1, r: 1 },
|
{ x: xScale(0), y: 0, cx: 0, cy: 1, r: 1 },
|
||||||
{ x: xScale(0), y: xScale(0), cx: 0, cy: 0, r: 1 },
|
|
||||||
{ x: 0, y: xScale(0), cx: 1, cy: 0, r: 1 },
|
{ x: 0, y: xScale(0), cx: 1, cy: 0, r: 1 },
|
||||||
|
{ x: xScale(0), y: xScale(0), cx: 0, cy: 0, r: 1 },
|
||||||
];
|
];
|
||||||
const gradientId = `${quadrant.position}-radial-gradient`,
|
const gradientId = `${quadrant.position}-radial-gradient`,
|
||||||
quadrantSize = config.chartConfig.size / 2;
|
quadrantSize = config.chartConfig.size / 2;
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ const RadarChart: React.FC<{
|
|||||||
<XAxis scale={xScale} />
|
<XAxis scale={xScale} />
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
{Object.values(config.quadrantsMap).map((value, index) => {
|
||||||
|
console.log(value)
|
||||||
|
return null
|
||||||
|
})}
|
||||||
{Object.values(config.quadrantsMap).map((value, index) => (
|
{Object.values(config.quadrantsMap).map((value, index) => (
|
||||||
<QuadrantRings
|
<QuadrantRings
|
||||||
key={index}
|
key={index}
|
||||||
|
|||||||
Reference in New Issue
Block a user