Skip to content

Commit

Permalink
feat(chart): fix DateTime type indexAxis
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwangyihao committed Oct 6, 2024
1 parent 9f208c0 commit 75d70db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extensions/chart/src/chartLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ watchEffect(() => {
data.value.datasets.forEach((dataset) => {
dataset.data.forEach((dataUnit, index) => {
if (!DataUtil.indexNumber(dataUnit) && data.value.labels && (data.value.labels[index] as DateTime).isValid) {
if (!dataUnit.index && data.value.labels && (data.value.labels[index] as DateTime).isValid) {
dataUnit.index = data.value.labels[index] as DateTime
}
})
Expand Down
10 changes: 4 additions & 6 deletions test/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,17 @@ onMounted(() => {
)"
>
<ChartDataset label="test1" :style="{ borderColor: '#f00', backgroundColor: '#f00' }">
<ChartData
:cross="1"
:style="{ borderRadius: 8 }"
/>
<ChartData :cross="1" />
<ChartData :cross="1" />
<ChartData :cross="2" />
<ChartData :cross="0" />
<ChartData :cross="1" />
</ChartDataset>
<ChartDataset label="test2" :style="{ borderColor: '#ff0', backgroundColor: '#ff0', borderRadius: 4 }">
<ChartDataset label="test2" :style="{ borderColor: '#ff0', backgroundColor: '#ff0', borderRadius: 4, tension: 0.2 }">
<ChartData :cross="2" />
<ChartData :cross="1" />
<ChartData :cross="3" />
<ChartData :cross="2" />
<ChartData :cross="1.5" :index="DateTime.fromISO('2021-03-15').setLocale('en-US')" />
</ChartDataset>
</LineChart>
</Motion>
Expand Down

0 comments on commit 75d70db

Please sign in to comment.