Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hitachi-weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
hitachi-weather
Commits
71576979
Commit
71576979
authored
Sep 27, 2022
by
Kornkitt Poolsup
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
circular chart gauge fixed
parent
60d222be
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
temp.html
+25
-14
No files found.
temp.html
View file @
71576979
...
@@ -195,15 +195,15 @@
...
@@ -195,15 +195,15 @@
}
}
.circular-chart.orange
.circle
{
.circular-chart.orange
.circle
{
stroke
:
#
ff9f
00
;
stroke
:
#
FA82
00
;
}
}
.circular-chart.
green
.circle
{
.circular-chart.
yellow
.circle
{
stroke
:
#
4CC790
;
stroke
:
#
FFC448
;
}
}
.circular-chart.blue
.circle
{
.circular-chart.blue
.circle
{
stroke
:
#
3c9ee5
;
stroke
:
#
4C80F8
;
}
}
.percentage
{
.percentage
{
...
@@ -310,7 +310,7 @@
...
@@ -310,7 +310,7 @@
</div>
</div>
<p
style=
"font-size: min(max(8px, 2.75vw), 15px); text-align: center; align-items: center;"
>
<p
style=
"font-size: min(max(8px, 2.75vw), 15px); text-align: center; align-items: center;"
>
Temperature
<br>
°C
</p>
Temperature
<br>
<span
style=
"color: #A1A8B9;"
>
(°C)
</span>
</p>
</div>
</div>
</div>
</div>
<div
class=
"col-4"
>
<div
class=
"col-4"
>
...
@@ -347,7 +347,7 @@
...
@@ -347,7 +347,7 @@
</svg>
</svg>
</div>
</div>
<p
style=
"font-size: min(max(9px, 3vw), 15px); text-align: center; align-items: center;"
>
<p
style=
"font-size: min(max(9px, 3vw), 15px); text-align: center; align-items: center;"
>
Humidity
<br>
%HR
Humidity
<br>
<span
style=
"color: #A1A8B9;"
>
(%HR)
</span>
</p>
</p>
</div>
</div>
</div>
</div>
...
@@ -384,7 +384,7 @@
...
@@ -384,7 +384,7 @@
<p
style=
"font-size: min(max(9px, 3vw), 15px); text-align: center; align-items: center;"
>
<p
style=
"font-size: min(max(9px, 3vw), 15px); text-align: center; align-items: center;"
>
PM 2.5
PM 2.5
<br>
<br>
(μg./m
<sup>
3
</sup>
)
<span
style=
"color: #A1A8B9;"
>
(μg./m
<sup>
3
</sup>
)
</span>
</p>
</p>
</div>
</div>
</div>
</div>
...
@@ -570,17 +570,28 @@
...
@@ -570,17 +570,28 @@
}
}
}
}
}).
done
(
function
(
data
)
{
}).
done
(
function
(
data
)
{
var
obj
=
jQuery
.
parseJSON
(
data
);
//mock
// data = "{ success: 1, data : { temperature: 28, humidity: 72, pm2dot5: 34 } }"
var
obj
=
(
typeof
data
==
"string"
)
?
jQuery
.
parseJSON
(
data
)
:
data
;
if
(
obj
.
success
==
1
)
{
if
(
obj
.
success
==
1
)
{
var
value
=
[
"temperature"
,
"humidity"
,
"pm2dot5"
];
var
value
=
[
{
params
:
"temperature"
,
color
:
"orange"
},
{
params
:
"humidity"
,
color
:
"blue"
},
{
params
:
"pm2dot5"
,
color
:
"yellow"
}
];
for
(
var
v
in
value
)
{
for
(
var
v
in
value
)
{
var
val
=
obj
.
data
[
value
[
v
]];
var
val
=
obj
.
data
[
value
[
v
].
params
];
if
(
value
[
v
]
==
"humidity"
)
val
/=
2
;
console
.
log
(
value
[
v
].
params
,
obj
.
data
[
value
[
v
].
params
])
if
(
value
[
v
].
params
==
"humidity"
)
val
/=
2
;
if
(
value
[
v
].
params
==
"pm2dot5"
)
val
/=
6
;
document
.
getElementById
(
`
${
value
[
v
]}
-gauge`
).
innerHTML
=
document
.
getElementById
(
`
${
value
[
v
]
.
params
}
-gauge`
).
innerHTML
=
`<svg viewBox="0 0 36 24" class="circular-chart
orange
">
`<svg viewBox="0 0 36 24" class="circular-chart
${
value
[
v
].
color
}
">
<g transform="rotate(270, 18, 18)" >
<g transform="rotate(270, 18, 18)" >
<path class="circle-bg"
<path class="circle-bg"
stroke-dasharray="50, 100"
stroke-dasharray="50, 100"
...
@@ -594,7 +605,7 @@
...
@@ -594,7 +605,7 @@
/>
/>
</g>
</g>
<text x="18" y="20.35" class="percentage" >
${
val
}
</text>
<text x="18" y="20.35" class="percentage" >
${
obj
.
data
[
value
[
v
].
params
]
}
</text>
</svg>`
;
</svg>`
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment