Re-added the graph drawing in the histogram example.
This commit is contained in:
parent
a0354058ec
commit
7d83b8ad37
|
@ -11,9 +11,10 @@ import (
|
||||||
"github.com/andlabs/ui"
|
"github.com/andlabs/ui"
|
||||||
)
|
)
|
||||||
|
|
||||||
var colorButton *ui.ColorButton
|
var (
|
||||||
|
datapoints [10]*ui.Spinbox
|
||||||
var datapoints [10]*ui.Spinbox
|
colorButton *ui.ColorButton
|
||||||
|
)
|
||||||
|
|
||||||
// some metrics
|
// some metrics
|
||||||
const (
|
const (
|
||||||
|
@ -119,27 +120,27 @@ func (areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
|
||||||
m.Translate(xoffLeft, yoffTop);
|
m.Translate(xoffLeft, yoffTop);
|
||||||
p.Context.Transform(m)
|
p.Context.Transform(m)
|
||||||
|
|
||||||
/*
|
|
||||||
// now get the color for the graph itself and set up the brush
|
// now get the color for the graph itself and set up the brush
|
||||||
uiColorButtonColor(colorButton, &graphR, &graphG, &graphB, &graphA);
|
graphR, graphG, graphB, graphA := colorButton.Color()
|
||||||
brush.Type = ui.Solid;
|
brush.Type = ui.Solid
|
||||||
brush.R = graphR;
|
brush.R = graphR
|
||||||
brush.G = graphG;
|
brush.G = graphG
|
||||||
brush.B = graphB;
|
brush.B = graphB
|
||||||
// we set brush.A below to different values for the fill and stroke
|
// we set brush.A below to different values for the fill and stroke
|
||||||
|
|
||||||
// now create the fill for the graph below the graph line
|
// now create the fill for the graph below the graph line
|
||||||
path = constructGraph(graphWidth, graphHeight, 1);
|
path = constructGraph(graphWidth, graphHeight, true)
|
||||||
brush.A = graphA / 2;
|
brush.A = graphA / 2
|
||||||
p.Context.Fill(path, brush)
|
p.Context.Fill(path, brush)
|
||||||
path.Free()
|
path.Free()
|
||||||
|
|
||||||
// now draw the histogram line
|
// now draw the histogram line
|
||||||
path = constructGraph(graphWidth, graphHeight, 0);
|
path = constructGraph(graphWidth, graphHeight, false)
|
||||||
brush.A = graphA;
|
brush.A = graphA
|
||||||
p.Context.Stroke(path, brush, sp)
|
p.Context.Stroke(path, brush, sp)
|
||||||
path.Free()
|
path.Free()
|
||||||
|
|
||||||
|
/*
|
||||||
// now draw the point being hovered over
|
// now draw the point being hovered over
|
||||||
if (currentPoint != -1) {
|
if (currentPoint != -1) {
|
||||||
double xs[10], ys[10];
|
double xs[10], ys[10];
|
||||||
|
|
Loading…
Reference in New Issue