This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package charts
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func ExampleLineChart() {
|
||||
c := NewLineChart(100, 100,
|
||||
LineValue{
|
||||
Value: 1,
|
||||
},
|
||||
LineValue{
|
||||
Value: 2,
|
||||
},
|
||||
LineValue{
|
||||
Value: 4,
|
||||
},
|
||||
LineValue{
|
||||
Value: 8,
|
||||
},
|
||||
LineValue{
|
||||
Value: 16,
|
||||
},
|
||||
LineValue{
|
||||
Value: 32,
|
||||
},
|
||||
).
|
||||
Min(0).
|
||||
Max(40).
|
||||
Foreground("purple").
|
||||
Background("pink").
|
||||
SVG().
|
||||
GetMarkup()
|
||||
|
||||
output := []byte(`<html><body>` + c + `</body></html>`)
|
||||
os.WriteFile("./line_chart.html", []byte(output), 0666)
|
||||
fmt.Println(c)
|
||||
// Output: <svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="height: auto; width: 100%" viewBox="0 0 100 100"></svg>
|
||||
}
|
||||
Reference in New Issue
Block a user