-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tktk4751
committed
Jan 25, 2024
1 parent
37c8130
commit 2a22af2
Showing
16 changed files
with
940 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
*.exe | ||
*.db | ||
bin/ | ||
data/ | ||
spot/ | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package chart | ||
|
||
import ( | ||
"math/rand" | ||
"os" | ||
|
||
"github.com/go-echarts/go-echarts/v2/charts" | ||
"github.com/go-echarts/go-echarts/v2/opts" | ||
) | ||
|
||
// generate random data for bar chart | ||
func generateBarItems() []opts.BarData { | ||
items := make([]opts.BarData, 0) | ||
for i := 0; i < 7; i++ { | ||
items = append(items, opts.BarData{Value: rand.Intn(300)}) | ||
} | ||
return items | ||
} | ||
|
||
func main() { | ||
// create a new bar instance | ||
bar := charts.NewBar() | ||
// set some global options like Title/Legend/ToolTip or anything else | ||
bar.SetGlobalOptions(charts.WithTitleOpts(opts.Title{ | ||
Title: "My first bar chart generated by go-echarts", | ||
Subtitle: "It's extremely easy to use, right?", | ||
})) | ||
|
||
// Put data into instance | ||
bar.SetXAxis([]string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}). | ||
AddSeries("Category A", generateBarItems()). | ||
AddSeries("Category B", generateBarItems()) | ||
// Where the magic happens | ||
f, _ := os.Create("pkg/chart/html/bar.html") | ||
bar.Render(f) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Awesome go-echarts</title> | ||
<script src="https://go-echarts.github.io/go-echarts-assets/assets/echarts.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="item" id="QctvNRkYxhXp" style="width:900px;height:500px;"></div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
"use strict"; | ||
let goecharts_QctvNRkYxhXp = echarts.init(document.getElementById('QctvNRkYxhXp'), "white"); | ||
let option_QctvNRkYxhXp = {"animation":true,"color":["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],"legend":{"show":true,"type":""},"series":[{"name":"Category A","type":"bar","smooth":false,"connectNulls":false,"showSymbol":false,"waveAnimation":false,"renderLabelForZeroData":false,"selectedMode":false,"animation":false,"data":[{"value":206},{"value":166},{"value":191},{"value":249},{"value":237},{"value":173},{"value":94}]},{"name":"Category B","type":"bar","smooth":false,"connectNulls":false,"showSymbol":false,"waveAnimation":false,"renderLabelForZeroData":false,"selectedMode":false,"animation":false,"data":[{"value":219},{"value":289},{"value":277},{"value":279},{"value":190},{"value":41},{"value":272}]}],"title":{"text":"My first bar chart generated by go-echarts","subtext":"It's extremely easy to use, right?"},"tooltip":{"show":false},"xAxis":[{"data":["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}],"yAxis":[{}]} | ||
; | ||
|
||
let action_QctvNRkYxhXp = {"areas":{},"type":""} | ||
; | ||
|
||
goecharts_QctvNRkYxhXp.setOption(option_QctvNRkYxhXp); | ||
goecharts_QctvNRkYxhXp.dispatchAction(action_QctvNRkYxhXp); | ||
</script> | ||
|
||
<style> | ||
.container {margin-top:30px; display: flex;justify-content: center;align-items: center;} | ||
.item {margin: auto;} | ||
</style> | ||
</body> | ||
</html> |
Oops, something went wrong.