mirror of
https://github.com/freqtrade/frequi.git
synced 2024-09-20 09:31:10 +00:00
Merge pull request #1634 from freqtrade/type/percentagetool
type percentage Tool
This commit is contained in:
commit
f62c05cb8b
|
@ -135,7 +135,11 @@ const diffCols = computed(() => {
|
|||
return getDiffColumnsFromPlotConfig(props.plotConfig);
|
||||
});
|
||||
|
||||
usePercentageTool(candleChart, props);
|
||||
usePercentageTool(
|
||||
candleChart,
|
||||
toRef(() => props.theme),
|
||||
toRef(() => props.dataset.timeframe_ms),
|
||||
);
|
||||
|
||||
function updateChart(initial = false) {
|
||||
if (!hasData.value) {
|
||||
|
|
|
@ -2,10 +2,10 @@ import { ElementEvent } from 'echarts';
|
|||
import { ROUND_CLOSER, roundTimeframe } from '@/shared/timemath';
|
||||
import humanizeDuration from 'humanize-duration';
|
||||
|
||||
export function usePercentageTool(chartRef, props) {
|
||||
export function usePercentageTool(chartRef, theme: Ref<string>, timeframe_ms: Ref<number>) {
|
||||
const inputListener = useKeyModifier('Shift', { events: ['keydown', 'keyup'] });
|
||||
|
||||
const color = computed(() => (props.theme === 'dark' ? 'white' : 'black'));
|
||||
const color = computed(() => (theme.value === 'dark' ? 'white' : 'black'));
|
||||
|
||||
const startPos = ref({ x: 0, y: 0 });
|
||||
const drawLimitPerSecond = 144;
|
||||
|
@ -13,7 +13,7 @@ export function usePercentageTool(chartRef, props) {
|
|||
const active = ref(false);
|
||||
|
||||
function roundTF(timestamp: number) {
|
||||
return roundTimeframe(props.dataset.timeframe_ms, timestamp, ROUND_CLOSER);
|
||||
return roundTimeframe(timeframe_ms.value, timestamp, ROUND_CLOSER);
|
||||
}
|
||||
|
||||
function mouseMove(e: ElementEvent) {
|
||||
|
@ -110,7 +110,7 @@ export function usePercentageTool(chartRef, props) {
|
|||
x: startPos.value.x + (xr - startPos.value.x) / 2,
|
||||
y: y < startPos.value.y ? y - 30 : y + 9,
|
||||
textAlign: 'center',
|
||||
text: `${timeDiff / props.dataset.timeframe_ms} bars (${
|
||||
text: `${timeDiff / timeframe_ms.value} bars (${
|
||||
startPrice < endPrice ? pct : '-' + pct
|
||||
}%) \n ${timeElapsed}`,
|
||||
font: '14px sans-serif',
|
||||
|
|
Loading…
Reference in New Issue
Block a user