Documentation ¶
Index ¶
- Constants
- Variables
- func BindRequest[T any](c echo.Context, request T) error
- func GetPaddings(req *ChartRequest) charts.Box
- func GetTitleSizes(req *ChartRequest) charts.TitleOption
- func GetURL(urlStr string) (string, error)
- func GracefulServerWithPid(e *echo.Echo, host string, port string)
- func HTTPErrorHandler(err error, c echo.Context)
- func IsAllowedDomain(urlStr string, allowedDomains string) bool
- func IsMiniChart(req *ChartRequest) bool
- func IsURL(urlStr string) bool
- func Logger() *logrus.Logger
- func NewEcho(baseURL string, publicDir embed.FS) *echo.Echo
- func NumberToK(num *float64) string
- func SetDataIfRemoteURL(req *ChartRequest) error
- func SetHeadersResponseHTML(header http.Header)
- func SetHeadersResponseImage(header http.Header, output string)
- func SetHeadersResponseTxt(header http.Header)
- func SetupRoutes(e *echo.Echo, baseURL string, publicDir embed.FS)
- func Truncate(s string, max int) string
- type BarChart
- func (c *BarChart) GetHorizontal(xData []string, yData [][]float64, names []string, req *ChartRequest) ([]byte, error)
- func (c *BarChart) GetStacked(xData []string, yData [][]float64, zData [][]float64, names []string, ...) ([]byte, error)
- func (c *BarChart) GetVertical(xData []string, yData [][]float64, names []string, req *ChartRequest) ([]byte, error)
- type BarChartData
- type BarChartHandler
- type Chart
- type ChartRequest
- type DonutChart
- type DonutChartData
- type DonutChartHandler
- type FunnelChart
- type FunnelChartData
- type FunnelChartHandler
- type HTTPErrorResponse
- type LineChart
- type LineChartData
- type LineChartHandler
- type PieChart
- type PieChartData
- type PieChartHandler
- type RadarChart
- type RadarChartData
- type RadarChartHandler
- type TableChart
- type TableChartData
- type TableChartHandler
- type ValidationErrs
Constants ¶
View Source
const ( DEFAULT_PADDING_TOP = 20 DEFAULT_PADDING_RIGHT = 20 DEFAULT_PADDING_BOTTOM = 20 DEFAULT_PADDING_LEFT = 20 DEFAULT_TITLE_FONT_SIZE = 12 DEFAULT_TITLE_MINI_FONT_SIZE = 10 DEFAULT_SUBTITLE_FONT_SIZE = 10 DEFAULT_SUBTITLE_MINI_FONT_SIZE = 9 MINI_CHART_WIDTH = 300 MINI_CHART_HEIGHT = 300 BAR_STYLE_VERTICAL = "vertical" BAR_STYLE_HORIZONTAL = "horizontal" BAR_STYLE_STACKED = "stacked" )
View Source
const ( DOCS_URL = "https://github.com/kevincobain2000/instachart" FAVICON_FILE = "favicon.ico" LOGO_FILE = "logo.png" ROBOTS_FILE = "robots.txt" ROBOTS_TXT = `` /* 137-byte string literal not displayed */ DIST_DIR = "frontend/dist" )
Variables ¶
View Source
var DEFAULT_SUBTITLE_COLOR = drawing.Color{
R: 112,
G: 128,
B: 144,
A: 255,
}
slate
Functions ¶
func BindRequest ¶
func GetPaddings ¶ added in v1.0.13
func GetPaddings(req *ChartRequest) charts.Box
func GetTitleSizes ¶ added in v1.0.13
func GetTitleSizes(req *ChartRequest) charts.TitleOption
func GracefulServerWithPid ¶
GracefulServerWithPid reloads server with pid kill -HUP when binary is changed kill -9 when want to kill the process and make the application dead and want to restart kill -9 is NOT FOR FAINT HEARTED and must not be done on prod unless SOUT
func HTTPErrorHandler ¶
func HTTPErrorHandler(err error, c echo.Context)
HTTPErrorHandler handles HTTP errors for entire application
func IsAllowedDomain ¶ added in v1.0.7
func IsMiniChart ¶ added in v1.0.13
func IsMiniChart(req *ChartRequest) bool
func NumberToK ¶ added in v1.0.8
NumberToK converts a number to a string with 'k' for thousands and 'm' for millions.
func SetDataIfRemoteURL ¶ added in v1.0.7
func SetDataIfRemoteURL(req *ChartRequest) error
func SetHeadersResponseHTML ¶ added in v1.0.4
func SetHeadersResponseImage ¶ added in v1.0.4
func SetHeadersResponseTxt ¶ added in v1.0.7
func SetupRoutes ¶
Types ¶
type BarChart ¶
type BarChart struct {
// contains filtered or unexported fields
}
func NewBarChart ¶
func NewBarChart() *BarChart
func (*BarChart) GetHorizontal ¶ added in v1.0.1
func (*BarChart) GetStacked ¶ added in v1.0.7
func (*BarChart) GetVertical ¶ added in v1.0.1
type BarChartData ¶
type BarChartHandler ¶
type BarChartHandler struct {
// contains filtered or unexported fields
}
func NewBarChartHandler ¶
func NewBarChartHandler() *BarChartHandler
func (*BarChartHandler) Get ¶
func (h *BarChartHandler) Get(c echo.Context) ([]byte, error)
type ChartRequest ¶ added in v1.0.1
type ChartRequest struct { ChartData string `json:"data" query:"data" form:"data" validate:"required" message:"data is required"` ChartTitle string `json:"title" query:"title" form:"title"` ChartSubtitle string `json:"subtitle" query:"subtitle" form:"subtitle"` Metric string `json:"metric" query:"metric" form:"metric"` Theme string `json:"theme" query:"theme" form:"theme" default:"light"` Width int `json:"width" query:"width" form:"width" default:"1024"` Height int `json:"height" query:"height" form:"height" default:"768"` Style string `json:"style" query:"style" form:"style" default:"vertical"` Line string `json:"line" query:"line" default:"nofill" validate:"oneof=nofill fill" message:"line must be fill"` Grid string `json:"grid" query:"grid" default:"show" validate:"oneof=show hide" message:"grid must be show or hide"` Output string `json:"output" query:"output" form:"output" default:"png"` }
type DonutChart ¶
type DonutChart struct {
// contains filtered or unexported fields
}
func NewDonutChart ¶
func NewDonutChart() *DonutChart
func (*DonutChart) Get ¶ added in v1.0.1
func (c *DonutChart) Get(values []float64, names []string, req *ChartRequest) ([]byte, error)
type DonutChartData ¶
type DonutChartHandler ¶
type DonutChartHandler struct {
// contains filtered or unexported fields
}
func NewDonutChartHandler ¶
func NewDonutChartHandler() *DonutChartHandler
func (*DonutChartHandler) Get ¶
func (h *DonutChartHandler) Get(c echo.Context) ([]byte, error)
type FunnelChart ¶ added in v1.0.2
type FunnelChart struct { }
func NewFunnelChart ¶ added in v1.0.2
func NewFunnelChart() *FunnelChart
func (*FunnelChart) Get ¶ added in v1.0.2
func (c *FunnelChart) Get(values []float64, names []string, req *ChartRequest) ([]byte, error)
type FunnelChartData ¶ added in v1.0.2
type FunnelChartHandler ¶ added in v1.0.2
type FunnelChartHandler struct {
// contains filtered or unexported fields
}
func NewFunnelChartHandler ¶ added in v1.0.2
func NewFunnelChartHandler() *FunnelChartHandler
func (*FunnelChartHandler) Get ¶ added in v1.0.2
func (h *FunnelChartHandler) Get(c echo.Context) ([]byte, error)
type HTTPErrorResponse ¶
type HTTPErrorResponse struct {
Error interface{} `json:"error"`
}
HTTPErrorResponse is the response for HTTP errors
type LineChart ¶
type LineChart struct {
// contains filtered or unexported fields
}
func NewLineChart ¶
func NewLineChart() *LineChart
type LineChartData ¶
type LineChartHandler ¶
type LineChartHandler struct {
// contains filtered or unexported fields
}
func NewLineChartHandler ¶
func NewLineChartHandler() *LineChartHandler
func (*LineChartHandler) Get ¶
func (h *LineChartHandler) Get(c echo.Context) ([]byte, error)
type PieChart ¶
type PieChart struct {
// contains filtered or unexported fields
}
func NewPieChart ¶
func NewPieChart() *PieChart
type PieChartData ¶
type PieChartHandler ¶
type PieChartHandler struct {
// contains filtered or unexported fields
}
func NewPieChartHandler ¶
func NewPieChartHandler() *PieChartHandler
func (*PieChartHandler) Get ¶
func (h *PieChartHandler) Get(c echo.Context) ([]byte, error)
type RadarChart ¶
type RadarChart struct { }
func NewRadarChart ¶
func NewRadarChart() *RadarChart
func (*RadarChart) Get ¶ added in v1.0.1
func (c *RadarChart) Get(values [][]float64, names []string, labels []string, req *ChartRequest) ([]byte, error)
func (*RadarChart) GetIndicators ¶
func (c *RadarChart) GetIndicators(values [][]float64) []float64
type RadarChartData ¶
type RadarChartHandler ¶
type RadarChartHandler struct {
// contains filtered or unexported fields
}
func NewRadarChartHandler ¶
func NewRadarChartHandler() *RadarChartHandler
func (*RadarChartHandler) Get ¶
func (h *RadarChartHandler) Get(c echo.Context) ([]byte, error)
type TableChart ¶ added in v1.0.2
type TableChart struct { }
func NewTableChart ¶ added in v1.0.2
func NewTableChart() *TableChart
func (*TableChart) Get ¶ added in v1.0.2
func (c *TableChart) Get(names []string, values [][]string, req *ChartRequest) ([]byte, error)
type TableChartData ¶ added in v1.0.2
type TableChartHandler ¶ added in v1.0.2
type TableChartHandler struct {
// contains filtered or unexported fields
}
func NewTableChartHandler ¶ added in v1.0.2
func NewTableChartHandler() *TableChartHandler
func (*TableChartHandler) Get ¶ added in v1.0.2
func (h *TableChartHandler) Get(c echo.Context) ([]byte, error)
type ValidationErrs ¶ added in v1.0.12
func ValidateRequest ¶
func ValidateRequest[T any](request T) (ValidationErrs, error)
Source Files ¶
- bar_chart.go
- bar_chart_handler.go
- chart.go
- donut_chart.go
- donut_chart_handler.go
- echo.go
- funnel_chart.go
- funnel_chart_handler.go
- line_chart.go
- line_chart_handler.go
- logger.go
- pie_chart.go
- pie_chart_handler.go
- radar_chart.go
- radar_chart_handler.go
- routes.go
- table_chart.go
- table_chart_handler.go
- util.go
- validator.go
Click to show internal directories.
Click to hide internal directories.