We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
封装了一个面积图组件,在单页面上多次渲染,会出现多个面积图同一个地方填色异常
No response
<script setup> import { Chart } from '@antv/g2'; import { stringify } from 'postcss'; import {onMounted, watch, ref} from "vue"; const props = defineProps({ data: { type: Array, required: true }, }) let chart; const container = ref(null); onMounted(() => { chart = renderChart(container.value); }) watch(() => props.data, () => { updateBarChart(chart, props.data); }); const updateBarChart = (chart, data) => { const interval = chart.getNodesByType('interval')[0]; interval.data(data); chart.render(); } const renderChart = (container) => { const chart = new Chart({ container, autoFit: true }); chart .data(props.data) // .area() .encode('x', 'date') .encode('y', 'value') .encode('color', 'type') .encode('shape', 'smooth') .axis('x', { title: false }) .axis('y', { title: false }) .scale('color', { relations: [ ['instagram', '#df8cf8'], ['twitter', '#fade98'], ['tiktok', '#8b83f7'], ['youtube', '#ef8d8a'], ['facebook', '#a6fcf6'], [(d) => d === undefined, 'grey'], ], }) .legend({ color: { itemMarker: 'itemMarker', }, }) chart.area().style('fillOpacity', 0.4); chart.line().style('strokeWidth', 2).tooltip(false); chart.render(); return chart; }; </script> <template> <div ref="container" class="w-full h-[340px] my-sm"></div> </template>
The text was updated successfully, but these errors were encountered:
哈喽,可以来一个在线可预览的地址方便调试吗?谢谢~ 是使用的这个 demo 案例吗?https://g2.antv.antgroup.com/examples/general/area/#orderly-area
Sorry, something went wrong.
No branches or pull requests
问题描述
封装了一个面积图组件,在单页面上多次渲染,会出现多个面积图同一个地方填色异常
重现链接
No response
重现步骤
预期行为
No response
平台
屏幕截图或视频(可选)
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: