mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-24 12:05:16 +00:00
Merge pull request #2125 from xzmeng/scatter-symbol-size
Some checks failed
Some checks failed
feat: add support to chagne scatter symbol size
This commit is contained in:
commit
9abfd61116
1
src/components.d.ts
vendored
1
src/components.d.ts
vendored
|
@ -35,6 +35,7 @@ declare module 'vue' {
|
||||||
BFormRadio: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadio']
|
BFormRadio: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadio']
|
||||||
BFormRadioGroup: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadioGroup']
|
BFormRadioGroup: typeof import('bootstrap-vue-next/components/BFormRadio')['BFormRadioGroup']
|
||||||
BFormSelect: typeof import('bootstrap-vue-next/components/BFormSelect')['BFormSelect']
|
BFormSelect: typeof import('bootstrap-vue-next/components/BFormSelect')['BFormSelect']
|
||||||
|
BFormSpinbutton: typeof import('bootstrap-vue-next/components/BFormSpinbutton')['BFormSpinbutton']
|
||||||
BFormTextarea: typeof import('bootstrap-vue-next/components/BFormTextarea')['BFormTextarea']
|
BFormTextarea: typeof import('bootstrap-vue-next/components/BFormTextarea')['BFormTextarea']
|
||||||
BInputGroup: typeof import('bootstrap-vue-next/components/BInputGroup')['BInputGroup']
|
BInputGroup: typeof import('bootstrap-vue-next/components/BInputGroup')['BInputGroup']
|
||||||
BListGroup: typeof import('bootstrap-vue-next/components/BListGroup')['BListGroup']
|
BListGroup: typeof import('bootstrap-vue-next/components/BListGroup')['BListGroup']
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ChartType, ChartTypeString, IndicatorConfig } from '@/types';
|
import { ChartType, ChartTypeString, IndicatorConfig } from '@/types';
|
||||||
|
|
||||||
import { watchDebounced } from '@vueuse/core';
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
modelValue: { required: true, type: Object as () => Record<string, IndicatorConfig> },
|
modelValue: { required: true, type: Object as () => Record<string, IndicatorConfig> },
|
||||||
columns: { required: true, type: Array as () => string[] },
|
columns: { required: true, type: Array as () => string[] },
|
||||||
|
@ -16,6 +14,7 @@ const availableGraphTypes = ref<ChartTypeString[]>(Object.keys(ChartType) as Cha
|
||||||
const selAvailableIndicator = ref('');
|
const selAvailableIndicator = ref('');
|
||||||
const cancelled = ref(false);
|
const cancelled = ref(false);
|
||||||
const fillTo = ref('');
|
const fillTo = ref('');
|
||||||
|
const scatterSymbolSize = ref(3);
|
||||||
|
|
||||||
function newColor() {
|
function newColor() {
|
||||||
selColor.value = randomColor();
|
selColor.value = randomColor();
|
||||||
|
@ -32,6 +31,9 @@ const combinedIndicator = computed<IndicatorConfig>(() => {
|
||||||
if (fillTo.value && graphType.value === ChartType.line) {
|
if (fillTo.value && graphType.value === ChartType.line) {
|
||||||
val.fill_to = fillTo.value;
|
val.fill_to = fillTo.value;
|
||||||
}
|
}
|
||||||
|
if (graphType.value == ChartType.scatter) {
|
||||||
|
val.scatterSymbolSize = scatterSymbolSize.value;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
[selAvailableIndicator.value]: val,
|
[selAvailableIndicator.value]: val,
|
||||||
};
|
};
|
||||||
|
@ -59,7 +61,7 @@ watch(
|
||||||
);
|
);
|
||||||
|
|
||||||
watchDebounced(
|
watchDebounced(
|
||||||
[selColor, graphType, fillTo],
|
[selColor, graphType, fillTo, scatterSymbolSize],
|
||||||
() => {
|
() => {
|
||||||
emitIndicator();
|
emitIndicator();
|
||||||
},
|
},
|
||||||
|
@ -108,5 +110,12 @@ watchDebounced(
|
||||||
class="mt-1"
|
class="mt-1"
|
||||||
label="Area chart - Fill to (leave empty for line chart)"
|
label="Area chart - Fill to (leave empty for line chart)"
|
||||||
/>
|
/>
|
||||||
|
<BFormGroup
|
||||||
|
v-if="graphType === ChartType.scatter"
|
||||||
|
label="Scatter symbol size"
|
||||||
|
label-class="mt-1"
|
||||||
|
>
|
||||||
|
<BFormSpinbutton v-model="scatterSymbolSize" />
|
||||||
|
</BFormGroup>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -10,6 +10,7 @@ export interface IndicatorConfig {
|
||||||
color?: string;
|
color?: string;
|
||||||
type?: ChartType | ChartTypeString;
|
type?: ChartType | ChartTypeString;
|
||||||
fill_to?: string;
|
fill_to?: string;
|
||||||
|
scatterSymbolSize?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlotConfig {
|
export interface PlotConfig {
|
||||||
|
|
|
@ -24,6 +24,12 @@ export function generateCandleSeries(
|
||||||
},
|
},
|
||||||
showSymbol: false,
|
showSymbol: false,
|
||||||
};
|
};
|
||||||
|
if (value.type === ChartType.scatter) {
|
||||||
|
sp['symbolSize'] = value.scatterSymbolSize ?? 3;
|
||||||
|
sp['emphasis'] = {
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user