Skip to content

Commit

Permalink
Add color to plot again (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasdeluna authored Aug 8, 2024
1 parent a51f4c5 commit ec7cd97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kateter-platform/graphica",
"version": "1.0.88",
"version": "1.0.89",
"source": "./src/index.ts",
"description": "A tool for advanced graphing and visualization",
"repository": {
Expand Down
10 changes: 8 additions & 2 deletions src/Components/Plot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type PlotOptions = {
coefficients?: Coefficients;
plotRange?: number;
plotBetween: [number, number] | undefined;
color: number;
};

const defaultPlotOptions = {
Expand All @@ -19,6 +20,7 @@ const defaultPlotOptions = {
lineWidth: 4,
coefficients: {},
plotBetween: undefined,
color: undefined,
};

type Coefficients = {
Expand Down Expand Up @@ -50,16 +52,20 @@ class Plot extends Component {
constructor(func: string, options?: PlotOptions) {
super();
this.setFuncName();
this.setColor();

const {
numPoints = 1000,
dashed = false,
lineWidth = 1,
coefficients = {},
plotBetween = undefined,
color,
} = { ...defaultPlotOptions, ...options };

if (!color) {
this.setColor();
} else {
this.color = color;
}
const minX = (-this.PLOTRANGE / 1) * 2 + 0;
const maxX = (this.PLOTRANGE / 1) * 2 + 0;
const initialCurve = new CatmullRomCurve3(
Expand Down

0 comments on commit ec7cd97

Please sign in to comment.