Перейти к содержанию

Навигация

SVG-Dashboards/en: различия между версиями

Нет описания правки
(Новая страница: «Syntax: <syntaxhighlight lang="javascript"> (CONDITION) ? 'VALUE1' : 'VALUE2' </syntaxhighlight>»)
 
(не показаны 2 промежуточные версии этого же участника)
Строка 21: Строка 21:
Full-screen mode allows you to switch between panels through the side menu, and in HMI mode, you need to implement the switch yourself: add a button (object) with a URL to the desired panel in the SVG image.
Full-screen mode allows you to switch between panels through the side menu, and in HMI mode, you need to implement the switch yourself: add a button (object) with a URL to the desired panel in the SVG image.


<gallery mode="packed" heights="150px" caption="Режимы панелей">
<gallery mode="packed" heights="150px" caption="Panel modes">
Image: WebUI SVG.png | Standard view
Image: WebUI SVG.png | Standard view
Image: WebUI SVG fullscreen.png | Fullscreen
Image: WebUI SVG fullscreen.png | Fullscreen
Строка 288: Строка 288:
The '''animation''' property sets the animation action parameters (animation duration, repetition, direction, movement type, steps), and the '''@keyframes''' block sets the animation itself in steps (changes in appearance and position).
The '''animation''' property sets the animation action parameters (animation duration, repetition, direction, movement type, steps), and the '''@keyframes''' block sets the animation itself in steps (changes in appearance and position).


<div lang="ru" dir="ltr" class="mw-content-ltr">
Let's use an example to create an animation to change the text color from red to green and vice versa. Since text is filled in SVG, you will need to change the '''fill''' property.
Покажем на примере создание анимации для изменения цвета текста с красного на зеленый и обратно. Так как в SVG текст выполняется заливкой, то потребуется изменять свойство '''fill'''.
[[Image: animation-style.png |350px|thumb|right| The '''animation''' property is set in the '''Value''' field of the '''Style''' parameter ]]
[[Image: animation-style.png |350px|thumb|right| Свойство '''animation''' задается в поле '''Value''' параметра '''Style''' ]]
#Let's create a new SVG document in the Inlscape editor and add the Text element to it.  
#Создадим новый SVG-документ в редакторе Inlskape и добавим в него элемент Текст.  
#Let's save the file and open it in a text editor.
#Сохраним файл и откроем его в текстовом редакторе.
#Add a style block like this:
#Добавим блок style следующего вида:
#:<syntaxhighlight lang="html">  
#:<syntaxhighlight lang="html">
<style>
  <style>
@keyframes changecolor {
@keyframes changecolor {
   0% {fill:red}
   0% {fill:red}
Строка 302: Строка 301:
   }
   }
   </style>
   </style>
</syntaxhighlight>
</syntaxhighlight>  
#Сохраним SVG-файл и загрузим его в контроллер.
#Save the SVG file and load it into the controller.
#В редакторе дашбордов выберем созданным тестовый элемент и зададим ему свойство animation в следующем виде:
#In the dashboard editor, select the created test element and set its animation property in the following form:
#:<syntaxhighlight lang="javascript">
#:<syntaxhighlight lang="javascript">  
(val > 20) ? 'animation: changecolor 3s infinite linear;' : ' '
(val > 20) ? 'animation: changecolor 3s infinite linear;' : ' '
</syntaxhighlight>
</syntaxhighlight>  
#:Так как изменение стиля элемента может происходить только по условию, в котором участвует значение из MQTT топика, то мы выбрали топик '''CPU Temperature''' и задали условие '''>20'''. Это значит, что анимация будет работать, только когда значение топика '''CPU Temperature''' больше 20.  
#:Since the element style can only be changed by a condition involving a value from the MQTT topic, we chose the '''CPU Temperature''' topic and set the condition '''>20'''. This means that the animation will only work when the value of the '''CPU Temperature''' topic is greater than 20.  
#Сохраним дашборд и перейдем в просмотр.
#Save the dashboard and go to the view.
== Добавление внешних ссылок ==
== Add external links ==
[[Image: svg-hyperlink.png |300px|thumb|right| Создание ссылки в Inkscape ]]
[[Image : svg-hyperlink.png |300px|thumb|right| Creating a link in Inkscape ]]
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
The transition to external links is set at the stage of creating a picture in the Inkscape editor.
Переход по внешним ссылкам задаётся на этапе создания картинки в редакторе Inkscape.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Create hyperlinks like this:
Создавать гиперссылки так:
# Select an element that will serve as a link, then in the context menu Create a link (hyperlink).
# Выбрать элемент, который будет служить ссылкой, далее в контекстном меню Создать ссылку (hyperlink).
# Insert a link into the opened field.
# Вставить в открывшееся поле ссылку.
# Save.
# Сохранить.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
Now it remains to load the image into the controller and check.
Теперь остаётся загрузить рисунок в контроллер и проверить.
</div>


<div lang="ru" dir="ltr" class="mw-content-ltr">
== Useful Links & Materials ==
== Полезные ссылки и материалы ==
* [[Media:Examples SVG-Dashboards.zip|SVG Dashboard Example Archive]]
* [[Media:Examples SVG-Dashboards.zip|Архив с примерами SVG-панелей]]
* [https://github.com/wirenboard/wb-dashboards- demo Sample panels in the wb-dashboards-demo repository]
* [https://github.com/wirenboard/wb-dashboards-demo Примеры панелей в репозитории wb-dashboards-demo]
* [https://support.wirenboard.com/t/vyvod-dannyh-v-vide-grafika-v-realnom-vremeni/13623/5 How to add to SVG panel link to a graph or another page]
* [https://support.wirenboard.com/t/vyvod-dannyh-v-vide-grafika-v-realnom-vremeni/13623/5 Как добавить в SVG-панель ссылку на график или другую страницу]
* [https://wirenboard.com/en/pages/wb-software/ Wiren Board Web Interface article]
* [https://wirenboard.com/ru/pages/wb-software/ Статья о веб-интерфейсе контроллера Wiren Board]
* [[Wiren Board Web Interface | Description of the controller web interface on the wiki]]
* [[Wiren Board Web Interface | Описание веб-интерфейса контроллера на вики]]
* [https://inkscape.org/en/ Free Inkscape SVG editor]
* [https://inkscape.org/ru/ Свободный SVG-редактор Inkscape]
</div>