brentp / Go Chartjs
Licence: mit
golang library to make https://chartjs.org/ plots (this is vanilla #golang, not gopherjs)
Stars: ✭ 42
Projects that are alternatives of or similar to Go Chartjs
Highcharts Chart
Polymer Element wrapper for highcharts library. Seamlessly create various types of charts from one element.
Stars: ✭ 97 (+130.95%)
Mutual labels: chart, plotting, plot
Uplot
📈 A small, fast chart for time series, lines, areas, ohlc & bars
Stars: ✭ 6,808 (+16109.52%)
Mutual labels: chart, plotting, plot
React Chartjs 2
React components for Chart.js, the most popular charting library
Stars: ✭ 4,667 (+11011.9%)
Mutual labels: chart, chartjs
svg plot
Plot data in SVG format using C++ (header only) library .
Stars: ✭ 20 (-52.38%)
Mutual labels: plot, plotting
Laravel Chartjs
Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library
Stars: ✭ 404 (+861.9%)
Mutual labels: chart, chartjs
sr graph
A simple, one-file, header-only, C++ utility for graphs, curves and histograms.
Stars: ✭ 67 (+59.52%)
Mutual labels: plot, plotting
Aachartcore Kotlin
📈📊⛰⛰⛰An elegant modern declarative data visualization chart framework for Android . Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.极其精美而又强大的 Android 数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
Stars: ✭ 332 (+690.48%)
Mutual labels: chart, plot
Chartpy
Easy to use Python API wrapper to plot charts with matplotlib, plotly, bokeh and more
Stars: ✭ 426 (+914.29%)
Mutual labels: chart, plotting
Ttyplot
a realtime plotting utility for terminal/console with data input from stdin
Stars: ✭ 532 (+1166.67%)
Mutual labels: chart, plot
Chartkick.py
Create beautiful Javascript charts with minimal code
Stars: ✭ 695 (+1554.76%)
Mutual labels: chart, chartjs
SwiftCharts
Easy to use and highly customizable charts library for iOS
Stars: ✭ 2,405 (+5626.19%)
Mutual labels: chart, plot
chartjs
go wrapper for chartjs
Chartjs charts are defined purely in JSON, so this library is mostly structs and struct-tags that dictate how to marshal to JSON. None of the currently implemented parts are stringly-typed in this library so it can avoid many errors.
The chartjs javascript/JSON api has a lot of surface area. Currently, only the options that I use are provided. More can and will be added as I need them (or via pull-requests).
There is a small amount of code to simplify creating charts.
data to be plotted by chartjs has to meet this interface.
type Values interface {
// X-axis values. If only these are specified then it must be a Bar plot.
Xs() []float64
// Optional Y values.
Ys() []float64
// Rs are used to size points for chartType `Bubble`. If this returns an
// empty slice then it's not used.
Rs() []float64
}
Example
This longish example shows common use of the library.
package main
import (
"log"
"math"
"os"
chartjs "github.com/brentp/go-chartjs"
)
// satisfy the required interface with this struct and methods.
type xy struct {
x []float64
y []float64
r []float64
}
func (v xy) Xs() []float64 {
return v.x
}
func (v xy) Ys() []float64 {
return v.y
}
func (v xy) Rs() []float64 {
return v.r
}
func check(e error) {
if e != nil {
log.Fatal(e)
}
}
func main() {
var xys1 xy
var xys2 xy
// make some example data.
for i := float64(0); i < 9; i += 0.1 {
xys1.x = append(xys1.x, i)
xys2.x = append(xys2.x, i)
xys1.y = append(xys1.y, math.Sin(i))
xys2.y = append(xys2.y, 3*math.Cos(2*i))
}
// a set of colors to work with.
colors := []*types.RGBA{
&types.RGBA{102, 194, 165, 220},
&types.RGBA{250, 141, 98, 220},
&types.RGBA{141, 159, 202, 220},
&types.RGBA{230, 138, 195, 220},
}
// a Dataset contains the data and styling info.
d1 := chartjs.Dataset{Data: xys1, BorderColor: colors[1], Label: "sin(x)", Fill: chartjs.False,
PointRadius: 10, PointBorderWidth: 4, BackgroundColor: colors[0]}
d2 := chartjs.Dataset{Data: xys2, BorderWidth: 8, BorderColor: colors[3], Label: "3*cos(2*x)",
Fill: chartjs.False, PointStyle: chartjs.Star}
chart := chartjs.Chart{Label: "test-chart"}
var err error
_, err = chart.AddXAxis(chartjs.Axis{Type: chartjs.Linear, Position: chartjs.Bottom, ScaleLabel: &chartjs.ScaleLabel{FontSize: 22, LabelString: "X", Display: chartjs.True}})
check(err)
d1.YAxisID, err = chart.AddYAxis(chartjs.Axis{Type: chartjs.Linear, Position: chartjs.Left,
ScaleLabel: &chartjs.ScaleLabel{LabelString: "sin(x)", Display: chartjs.True}})
check(err)
chart.AddDataset(d1)
d2.YAxisID, err = chart.AddYAxis(chartjs.Axis{Type: chartjs.Linear, Position: chartjs.Right,
ScaleLabel: &chartjs.ScaleLabel{LabelString: "3*cos(2*x)", Display: chartjs.True}})
check(err)
chart.AddDataset(d2)
chart.Options.Responsive = chartjs.False
wtr, err := os.Create("example-chartjs-multi.html")
if err != nil {
}
if err := chart.SaveHTML(wtr, nil); err != nil {
log.Fatal(err)
}
wtr.Close()
}
The resulting html will have an interactive <canvas>
element that looks like this.
Live Examples
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].