diff --git a/package.json b/package.json index ff80e3a..a5f3585 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/Components/Plot.ts b/src/Components/Plot.ts index cf38e56..de7f612 100644 --- a/src/Components/Plot.ts +++ b/src/Components/Plot.ts @@ -11,6 +11,7 @@ type PlotOptions = { coefficients?: Coefficients; plotRange?: number; plotBetween: [number, number] | undefined; + color: number; }; const defaultPlotOptions = { @@ -19,6 +20,7 @@ const defaultPlotOptions = { lineWidth: 4, coefficients: {}, plotBetween: undefined, + color: undefined, }; type Coefficients = { @@ -50,7 +52,6 @@ class Plot extends Component { constructor(func: string, options?: PlotOptions) { super(); this.setFuncName(); - this.setColor(); const { numPoints = 1000, @@ -58,8 +59,13 @@ class Plot extends Component { 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(