Skip to content

Commit 171dec4

Browse files
authored
Merge pull request #4330 from VisActor/release/2.0.10
[Auto release] release 2.0.10
2 parents e37efb4 + 6ab6281 commit 171dec4

File tree

74 files changed

+4026
-324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4026
-324
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 67 additions & 67 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"2.0.7","mainProject":"@visactor/vchart","nextBump":"patch"}]
1+
[
2+
{
3+
"definitionName": "lockStepVersion",
4+
"policyName": "vchartMain",
5+
"version": "2.0.9",
6+
"mainProject": "@visactor/vchart",
7+
"nextBump": "patch"
8+
}
9+
]

docs/assets/api/en/API/vchart.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,9 @@ getCurrentThemeName: () => string;
763763

764764
### setCurrentTheme
765765

766-
**asynchronous method**, set the current Theme.
766+
**Asynchronous method**, set the current Theme.
767+
768+
**Note: If the `theme` property is configured in the chart spec, the `spec.theme` has higher priority.**
767769

768770
```ts
769771
/**
@@ -774,6 +776,66 @@ getCurrentThemeName: () => string;
774776
setCurrentTheme: (name: string) => Promise<IVChart>;
775777
```
776778

779+
Usage example:
780+
781+
```javascript livedemo
782+
// Define custom theme
783+
const customTheme = {
784+
colorScheme: {
785+
default: [
786+
'#FF6B6B',
787+
'#4ECDC4',
788+
'#45B7D1',
789+
'#FFA07A',
790+
'#98D8C8',
791+
'#F7DC6F',
792+
'#BB8FCE',
793+
'#85C1E2'
794+
]
795+
},
796+
series: {
797+
bar: {
798+
barMaxWidth: 20,
799+
label: {
800+
visible: true,
801+
position: 'top'
802+
}
803+
}
804+
}
805+
};
806+
807+
// Register theme
808+
VChart.ThemeManager.registerTheme('myCustomTheme', customTheme);
809+
810+
const spec = {
811+
type: 'bar',
812+
data: [
813+
{
814+
id: 'barData',
815+
values: [
816+
{ type: 'A', value: 120 },
817+
{ type: 'B', value: 200 },
818+
{ type: 'C', value: 150 },
819+
{ type: 'D', value: 80 }
820+
]
821+
}
822+
],
823+
xField: 'type',
824+
yField: 'value'
825+
};
826+
827+
const vchart = new VChart(spec, { dom: CONTAINER_ID });
828+
vchart.renderSync();
829+
830+
// Set theme through instance method
831+
vchart.setCurrentTheme('myCustomTheme');
832+
```
833+
834+
**Note**:
835+
- Before using the `setCurrentTheme` method, you need to register the theme first through `VChart.ThemeManager.registerTheme()`
836+
- This method is asynchronous and returns a Promise, you can use `await` or `.then()` to handle it
837+
- If the `theme` property is configured in the chart spec, the theme in the spec has higher priority
838+
777839
### setTooltipHandler
778840

779841
When the configuration item cannot meet the display needs of the tooltip, we also provide the ability to customize the tooltip. You can configure `TooltipHandler` To override the default tooltip presentation logic.

0 commit comments

Comments
 (0)