|
| 1 | +/* |
| 2 | + Copyright (C) 2011 by Jeremy Cowgar <[email protected]> |
| 3 | +
|
| 4 | + This file is part of go-iup. |
| 5 | +
|
| 6 | + go-iup is free software: you can redistribute it and/or modify |
| 7 | + it under the terms of the GNU Lesser General Public License as |
| 8 | + published by the Free Software Foundation, either version 3 of |
| 9 | + the License, or (at your option) any later version. |
| 10 | +
|
| 11 | + go-iup is distributed in the hope that it will be useful, |
| 12 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + GNU General Public License for more details. |
| 15 | +
|
| 16 | + You should have received a copy of the GNU Lesser General Public |
| 17 | + License along with go-iup. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +*/ |
| 19 | + |
| 20 | +package main |
| 21 | + |
| 22 | +import ( |
| 23 | + "github.com/jcowgar/go-iup" |
| 24 | +) |
| 25 | + |
| 26 | +func main() { |
| 27 | + iup.Open() |
| 28 | + defer iup.Close() |
| 29 | + |
| 30 | + pplot := iup.PPlot("EXPAND=YES") |
| 31 | + pplot.StoreAttribute("TITLE", "Bar Mode") |
| 32 | + pplot.StoreAttribute("TITLEFONTSIZE", "16") |
| 33 | + pplot.StoreAttribute("MARGINTOP", "40") |
| 34 | + pplot.StoreAttribute("MARGINLEFT", "30") |
| 35 | + pplot.StoreAttribute("MARGINBOTTOM","65") |
| 36 | + |
| 37 | + labels := []string{ |
| 38 | + "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
| 39 | + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"} |
| 40 | + values := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12} |
| 41 | + |
| 42 | + pplot.PlotBegin(1) |
| 43 | + for i := 0; i < len(labels); i++ { |
| 44 | + pplot.PlotAddStr(labels[i], values[i]) |
| 45 | + } |
| 46 | + pplot.PlotEnd() |
| 47 | + pplot.StoreAttribute("DS_MODE", "BAR") |
| 48 | + pplot.StoreAttribute("DS_COLOR", "100 100 200") |
| 49 | + |
| 50 | + dlg := iup.Dialog(pplot, "SIZE=200x200,TITLE=\"PPlot Example\"") |
| 51 | + dlg.Show() |
| 52 | + |
| 53 | + pplot.StoreAttribute("REDRAW", "") |
| 54 | + |
| 55 | + iup.MainLoop() |
| 56 | +} |
0 commit comments