style = {
let normal = inputs.layout == "Normal"
let cellHeight = normal ? 60 : 50;
let theme = inputs.theme
let antitheme = theme == "white" ? "black" : "white"
let alphaCoeff = theme=="white"? 1 : -1
let common = {
cellHeight : cellHeight,
chartHeight: normal ? 90 : 60,
chartBarMargin: 20,
marginW : 10,
marginH : 12,
sqWidth : cellHeight * 1.3,
themeColor: theme,
antiThemeColor: antitheme,
blockFillColor: "white",
blockWeakTopScale: 0.85,
indicatorLineColor: (theme == "white") ? "red" : "gold",
indicatorLineWidth: (theme == "white") ? 2 : 3,
axisFill: antitheme,
axisStroke: antitheme,
backgroundColor: theme,
timeWidth : normal? cellHeight * 1.6 : cellHeight * 2,
stageWidth : normal? cellHeight * 1.2 : cellHeight * 1.6,
fadeAlphaSource: 0.0,
fadeAlphaTarget: alphaCoeff * 0.3,
defaultBarFillColor: theme,
barAlpha: normal? alphaCoeff * 0.5 : 0,
barTextColor: normal ? "white" : antitheme,
barStrokeColor: normal? null : antitheme,
barArrowWidth: 15,
barArrowWeight: 3,
barArrowStroke: "white",
barOrder: ["stage", "time", "move"]
}
function getHorizontal() {
let sty = {
tickHeight: 5,
tickLargeHeight: 10,
xAxisWidth: 400,
axisFont: 'bold 13px arial',
moveWidth : normal? cellHeight * 4 :cellHeight * 5,
blockWeakBottomScale: normal && inputs.TPS == "Show" ? 0.9 : 0.20,
backgroundColor: theme,
}
sty = Object.assign(common, sty)
let isChartTop = inputs.position == "ChartOnTop"
let axisTop = isChartTop ? margin.top : sty.cellHeight + margin.top + sty.chartBarMargin,
axisBottom = axisTop + sty.chartHeight,
axisLeft = margin.left,
axisRight = axisLeft + sty.xAxisWidth;
sty.axisStyle = {
top: axisTop, bottom: axisBottom, left: axisLeft, right: axisRight
}
sty.barLeft = margin.left // sty.timeWidth
sty.barTop = isChartTop ? axisBottom + sty.chartBarMargin : margin.top
return sty
}
function getVertical() {
let sty = {
tickHeight: 3,
tickLargeHeight: 7,
xAxisWidth: 250,
axisFont: '11px arial',
moveWidth : normal? cellHeight * 4.5 :cellHeight * 5.5,
blockWeakBottomScale: (normal && inputs.TPS == "Show") ? 0.6 : 0.1,
axisFill: theme == "white" ? "#333" : "white",
axisStroke: theme == "white" ? "#333" : "white",
}
sty = Object.assign(common, sty)
// notice here x, y are flipped
let axisTop = margin.left * 0.35,
axisBottom = axisTop + sty.chartHeight,
axisLeft = margin.top, //+ sty.cellHeight,
axisRight = axisLeft + sty.xAxisWidth;
sty.axisStyle = {
top: axisTop, bottom: axisBottom, left: axisLeft, right: axisRight
}
let isChartTop = inputs.position == "ChartOnTop"
sty.barLeft = sty.chartHeight + axisTop + sty.chartBarMargin * 0.5;
sty.barTop = isChartTop ? axisRight + sty.chartBarMargin : margin.top * 0.2
sty.barLeft += parseInt(barSlider.x) | 0
sty.barTop += parseInt(barSlider.y) | 0
return sty
}
return inputs.direction == "Horizontal" ? getHorizontal() : getVertical()
}