[Common scripts] About scripts

vividime-Club Show all floors Published on 2024-12-17 17:57:45 |Reading mode print Previous Topic Next Topic
1
Unresolved

【Common scripts】 About scripts

1099 1
How to creat scripts?
reply

Using props report

Exciting comments1

vividime-Club Show all floors Published on 2024-12-17 17:57:55
In order to help you create a dashboard faster, this section describes how to quickly create a script.
2. Basic idea for creating script
JavaScript is an object-oriented programming language, we can define our own object and variable types, usually there are several steps to create a script:
1)Determine the objects that need to be controlled by the script.
2)Determine the attributes that need to be controlled, such as text color, font size, visibility, etc., and define the variables.
3)assign the defined variables to the target area through the function
3. Object-based script
In the script you can use the top-level scope of the function to create the object, DimCol can create dimension fields, DateCol can create date-type fields, Locator can locate the region and so on, the detailed function and the introduction can refer to the Object.
If we want to set the format of the chart component, for example, set the column axis label background color to yellow;
1)It has been clarified that the object is the chart column axis label area. You can select the corresponding area, click Copy Locator in the lower right corner, and obtain the Locator (["Market"], AXIS_LABEL, DETAIL).
2)The property to be controlled is the font color, so you need to construct a color first, in the object you can find Color construct the color of the five expressions written:
•var a = new Color();// take the default color without parameters, defaults to black.
•var b = new Color(java.awt.Color.RED); // java.awt.Color object as parameter object.
•var c = new Color(11184810); // The color is 0xAAAAAA, the parameter is a decimal integer data.
•var d = new Color(22, 123, 222); // Creates an opaque sRGB color with the specified red, green and blue values, all in the range (0 - 255).
•var e = new Color(22, 123, 222, 10); // Create an sRGB color with the specified red, green, blue and transparent values, all in the range (0 - 255).
3) Find the Set Background color function in the component's functions:
4) Follow the function instructions and enter the JS script with the correct syntax:
The effect is as follows:
reply

Using props report

Advanced mode
You need to log in before you can reply to the post login | Free registration

© 2024 VIVIDATA PTE. LTD. All Rights Reserved. Privacy Statement