|
|
@@ -44,6 +44,8 @@ resource.FrameLogo.Text = null
|
|
|
Chart.JSConsole.Chart.Log = () => ({})
|
|
|
Chart.JSConsole.Complier.Log = () => ({})
|
|
|
|
|
|
+const GetDevicePixelRatio = () => window.devicePixelRatio || 1
|
|
|
+
|
|
|
const setChartStyle = (defaultTheme?: keyof typeof AppTheme) => {
|
|
|
const rootElement = document.documentElement
|
|
|
const computedStyles = window.getComputedStyle(rootElement)
|
|
|
@@ -58,14 +60,16 @@ const setChartStyle = (defaultTheme?: keyof typeof AppTheme) => {
|
|
|
const elStyle = chartEl.style
|
|
|
const theme = defaultTheme ? AppTheme[defaultTheme] : globalStore.appTheme
|
|
|
|
|
|
- // https://blog.csdn.net/jones2000/article/details/90286933
|
|
|
+ // https://github.com/jones2000/HQChart/wiki/4.-%E9%A2%9C%E8%89%B2%E9%A3%8E%E6%A0%BC%E9%85%8D%E7%BD%AE
|
|
|
switch (theme) {
|
|
|
case AppTheme.Dark: {
|
|
|
const blackStyle = hqChartStyle.GetStyleConfig(Chart.STYLE_TYPE_ID.BLACK_ID) // 黑色风格
|
|
|
blackStyle.UpBarColor = upBarColor
|
|
|
blackStyle.DownBarColor = downBarColor
|
|
|
+
|
|
|
blackStyle.UpTextColor = upBarColor
|
|
|
blackStyle.DownTextColor = downBarColor
|
|
|
+
|
|
|
blackStyle.FrameLatestPrice = {
|
|
|
UpBarColor: upBarColor,
|
|
|
DownBarColor: downBarColor
|
|
|
@@ -77,15 +81,26 @@ const setChartStyle = (defaultTheme?: keyof typeof AppTheme) => {
|
|
|
}
|
|
|
default: {
|
|
|
const whiteStyle = hqChartStyle.GetStyleConfig(Chart.STYLE_TYPE_ID.WHITE_ID) // 白色风格
|
|
|
- whiteStyle.UpBarColor = upBarColor
|
|
|
- whiteStyle.DownBarColor = downBarColor
|
|
|
- whiteStyle.UpTextColor = upBarColor
|
|
|
- whiteStyle.DownTextColor = downBarColor
|
|
|
+ whiteStyle.UpBarColor = upBarColor // 上涨柱子颜色
|
|
|
+ whiteStyle.DownBarColor = downBarColor // 下跌柱子颜色
|
|
|
+
|
|
|
+ whiteStyle.UpTextColor = upBarColor // 上涨文字颜色
|
|
|
+ whiteStyle.DownTextColor = downBarColor // 下跌文字颜色
|
|
|
+ whiteStyle.UnchagneTextColor = '#999' // 平盘文字颜色
|
|
|
+
|
|
|
+ whiteStyle.FrameBorderPen = '#f2f2f2' // 边框颜色
|
|
|
+ whiteStyle.FrameSplitPen = '#f2f2f2' // 刻度分割线
|
|
|
+ whiteStyle.FrameDotSplitPen = '#ccc' // 分割虚线
|
|
|
+
|
|
|
whiteStyle.FrameLatestPrice = {
|
|
|
UpBarColor: upBarColor,
|
|
|
DownBarColor: downBarColor
|
|
|
}
|
|
|
|
|
|
+ whiteStyle.Frame = {
|
|
|
+ XBottomOffset: 10 * GetDevicePixelRatio() // X轴文字向下偏移
|
|
|
+ }
|
|
|
+
|
|
|
jsChart.SetStyle(whiteStyle)
|
|
|
elStyle.setProperty('background-color', '#fff')
|
|
|
}
|