Skip to content

Commit

Permalink
fix: CombinedChart supports custom renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Apr 12, 2021
1 parent 9108923 commit 9392d3a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 21 additions & 0 deletions src/charting/charts/CombinedChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import { CombinedDataProvider } from '../interfaces/dataprovider/CombinedDataPro
import { IDataSet } from '../interfaces/datasets/IDataSet';
import { BarLineChartBase } from './BarLineChartBase';
import { CombinedChartRenderer } from '../renderer/CombinedChartRenderer';
import { CustomRenderer as BBCustomRenderer } from './BubbleChart';
import { CustomRenderer as CSCustomRenderer } from './CandleStickChart';
import { CustomRenderer as BCustomRenderer } from './BarChart';
import { CustomRenderer as LCustomRenderer } from './LineChart';
import { CustomRenderer as SCustomRenderer } from './ScatterChart';

export type CustomRenderer = BBCustomRenderer & CSCustomRenderer & BCustomRenderer & LCustomRenderer & SCustomRenderer;

/**
* enum that allows to specify the order in which the different data objects
Expand Down Expand Up @@ -219,4 +226,18 @@ export class CombinedChart extends BarLineChartBase<Entry, BarLineScatterCandleB
this.mMarker.draw(c, pos[0], pos[1]);
}
}

mCustomRenderer: CustomRenderer;
/**
* set a custom line renderer
*/
public setCustomRenderer(renderer: CustomRenderer) {
this.mCustomRenderer = renderer;
}
/**
* get the custom line renderer
*/
public getCustomRenderer() {
return this.mCustomRenderer;
}
}
4 changes: 0 additions & 4 deletions src/charting/renderer/CombinedChartRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ChartAnimator } from '../animation/ChartAnimator';
import { Chart } from '../charts/Chart';
import { CombinedChart, DrawOrder } from '../charts/CombinedChart';
import { ViewPortHandler } from '../utils/ViewPortHandler';
import { DataRenderer } from './DataRenderer';
Expand All @@ -8,11 +7,8 @@ import { BarChartRenderer } from './BarChartRenderer';
import { BubbleChartRenderer } from './BubbleChartRenderer';
import { CandleStickChartRenderer } from './CandleStickChartRenderer';
import { ScatterChartRenderer } from './ScatterChartRenderer';
import { BarLineChartBase } from '../charts/BarLineChartBase';
import { Entry } from '../data/Entry';
import { Canvas } from '@nativescript-community/ui-canvas';
import { Highlight } from '../highlight/Highlight';
import { CombinedData } from '../data/CombinedData';
/**
* Renderer class that is responsible for rendering multiple different data-types.
*/
Expand Down

0 comments on commit 9392d3a

Please sign in to comment.