FromMetaMap sets plot options from meta data map.
(meta map[string]string)
| 110 | |
| 111 | // FromMetaMap sets plot options from meta data map. |
| 112 | func (po *PlotOptions) FromMetaMap(meta map[string]string) { |
| 113 | if typ, has := metaMapLower(meta, "Type"); has { |
| 114 | po.Type.SetString(typ) |
| 115 | } |
| 116 | if op, has := metaMapLower(meta, "Lines"); has { |
| 117 | if op == "+" || op == "true" { |
| 118 | po.Lines = true |
| 119 | } else { |
| 120 | po.Lines = false |
| 121 | } |
| 122 | } |
| 123 | if op, has := metaMapLower(meta, "Points"); has { |
| 124 | if op == "+" || op == "true" { |
| 125 | po.Points = true |
| 126 | } else { |
| 127 | po.Points = false |
| 128 | } |
| 129 | } |
| 130 | if lw, has := metaMapLower(meta, "LineWidth"); has { |
| 131 | po.LineWidth, _ = reflectx.ToFloat32(lw) |
| 132 | } |
| 133 | if ps, has := metaMapLower(meta, "PointSize"); has { |
| 134 | po.PointSize, _ = reflectx.ToFloat32(ps) |
| 135 | } |
| 136 | if bw, has := metaMapLower(meta, "BarWidth"); has { |
| 137 | po.BarWidth, _ = reflectx.ToFloat32(bw) |
| 138 | } |
| 139 | if op, has := metaMapLower(meta, "NegativeXDraw"); has { |
| 140 | if op == "+" || op == "true" { |
| 141 | po.NegativeXDraw = true |
| 142 | } else { |
| 143 | po.NegativeXDraw = false |
| 144 | } |
| 145 | } |
| 146 | if scl, has := metaMapLower(meta, "Scale"); has { |
| 147 | po.Scale, _ = reflectx.ToFloat32(scl) |
| 148 | } |
| 149 | if xc, has := metaMapLower(meta, "XAxis"); has { |
| 150 | po.XAxis = xc |
| 151 | } |
| 152 | if lc, has := metaMapLower(meta, "Legend"); has { |
| 153 | po.Legend = lc |
| 154 | } |
| 155 | if xrot, has := metaMapLower(meta, "XAxisRotation"); has { |
| 156 | po.XAxisRotation, _ = reflectx.ToFloat32(xrot) |
| 157 | } |
| 158 | if lb, has := metaMapLower(meta, "XAxisLabel"); has { |
| 159 | po.XAxisLabel = lb |
| 160 | } |
| 161 | if lb, has := metaMapLower(meta, "YAxisLabel"); has { |
| 162 | po.YAxisLabel = lb |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | // ColumnOptions are options for plotting one column of data. |
| 167 | type ColumnOptions struct { //types:add |
no test coverage detected