This commit is contained in:
Will Charczuk 2019-02-13 16:09:26 -08:00
parent 3cb33d48d3
commit 26eaa1d898
76 changed files with 1076 additions and 1717 deletions

View file

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/hashworks/go-chart"
"log"
"net/http"
chart "github.com/wcharczuk/go-chart"
)
const style = "svg .background { fill: white; }" +
@ -45,9 +46,9 @@ func svgWithCustomInlineCSSNonce(res http.ResponseWriter, _ *http.Request) {
func svgWithCustomExternalCSS(res http.ResponseWriter, _ *http.Request) {
// Add external CSS
res.Write([]byte(
`<?xml version="1.0" standalone="no"?>`+
`<?xml-stylesheet href="/main.css" type="text/css"?>`+
`<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">`))
`<?xml version="1.0" standalone="no"?>` +
`<?xml-stylesheet href="/main.css" type="text/css"?>` +
`<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">`))
res.Header().Set("Content-Type", chart.ContentTypeSVG)
err := pieChart().Render(chart.SVG, res)