![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
git.smarteching.com/zeni/go-chart/v2
This project starts from a full copy from https://git.smarteching.com/zeni/go-chart. 28 Oct 2024.
Master should now be on the v3.x codebase, which overhauls the api significantly. Per usual, see examples
for more information.
To install chart
run the following:
> go get git.smarteching.com/zeni/go-chart/v2@latest
Most of the components are interchangeable so feel free to crib whatever you want.
Spark Lines:
Single axis:
Two axis:
Pie Chart:
The code for this chart can be found in examples/pie_chart/main.go
.
Stacked Bar:
The code for this chart can be found in examples/stacked_bar/main.go
.
Actual chart configurations and examples can be found in the ./examples/
directory. They are simple CLI programs that write to output.png
(they are also updated with go generate
.
If folder ends in "web", has web servers, so start them with go run main.go
then access http://localhost:8080
to see the output.
Everything starts with the chart.Chart
object. The bare minimum to draw a chart would be the following:
import (
...
"bytes"
...
"git.smarteching.com/zeni/go-chart/v2" //exposes "chart"
)
graph := chart.Chart{
Series: []chart.Series{
chart.ContinuousSeries{
XValues: []float64{1.0, 2.0, 3.0, 4.0},
YValues: []float64{1.0, 2.0, 3.0, 4.0},
},
},
}
buffer := bytes.NewBuffer([]byte{})
err := graph.Render(chart.PNG, buffer)
Explanation of the above: A chart
can have many Series
, a Series
is a collection of things that need to be drawn according to the X range and the Y range(s).
Here, we have a single series with x range values as float64s, rendered to a PNG. Note; we can pass any type of io.Writer
into Render(...)
, meaning that we can render the chart to a file or a resonse or anything else that implements io.Writer
.
Everything on the chart.Chart
object has defaults that can be overriden. Whenever a developer sets a property on the chart object, it is to be assumed that value will be used instead of the default.
The best way to see the api in action is to look at the examples in the ./_examples/
directory.
I wanted to make a charting library that used only native golang, that could be stood up on a server (i.e. it had built in fonts).
The goal with the API itself is to have the "zero value be useful", and to require the user to not code more than they absolutely needed.
Contributions are welcome though this library is in a holding pattern for the forseable future.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.