// AddData adds points in data to chart. A key/legend entry is produced
// if name is not empty.
161962
func (c *ScatterChart) AddData(name string, data []EPoint, plotstyle PlotStyle, style Style) {

	// Update styles if non given
	if plotstyle.undefined() {
		plotstyle = PlotStylePoints
	}
	if style.empty() {
		style = AutoStyle(len(c.Data), false)
	}
	// Fix missing values in style
	if (plotstyle & PlotStyleLines) != 0 {
		if style.LineWidth <= 0 {
			style.LineWidth = 1
		}
		if style.LineColor == nil {
			style.LineColor = style.SymbolColor
		}
	}
	if (plotstyle&PlotStylePoints) != 0 && style.Symbol == 0 {
		style.Symbol = '#'
	}

	// Init axis
	if len(c.Data) == 0 {
		c.XRange.init()
		c.YRange.init()
	}

	// Add data
	scd := ScatterChartData{Name: name, PlotStyle: plotstyle, Style: style, Samples: data, Func: nil}
	c.Data = append(c.Data, scd)

	// Autoscale
	for _, d := range data {
		xl, yl, xh, yh := d.BoundingBox()
		c.XRange.autoscale(xl)
		c.XRange.autoscale(xh)
		c.YRange.autoscale(yl)
		c.YRange.autoscale(yh)
	}

	// Add key/legend entry
	if name != "" {
		ke := KeyEntry{Style: style, PlotStyle: plotstyle, Text: name}
		c.Key.Entries = append(c.Key.Entries, ke)
	}
}
78209
func (s scope) alldata() scope {
	for i := range s {
		var ri = len(s) - i - 1
		if s[ri].entered {
			return s[:ri+1 : ri+1]
		}
	}
	panic("impossible")
}
932519
func (s *Attachment) SetData(v []byte) *Attachment {
	s.Data = v
	return s
}
1333708
func AddDataFuncs(f map[string]interface{}, d *data.Data) {
	f["datasource"] = d.Datasource
	f["ds"] = d.Datasource
	f["datasourceExists"] = d.DatasourceExists
	f["datasourceReachable"] = d.DatasourceReachable
	f["defineDatasource"] = d.DefineDatasource
	f["include"] = d.Include

	f["data"] = DataNS

	f["json"] = DataNS().JSON
	f["jsonArray"] = DataNS().JSONArray
	f["yaml"] = DataNS().YAML
	f["yamlArray"] = DataNS().YAMLArray
	f["toml"] = DataNS().TOML
	f["csv"] = DataNS().CSV
	f["csvByRow"] = DataNS().CSVByRow
	f["csvByColumn"] = DataNS().CSVByColumn
	f["toJSON"] = DataNS().ToJSON
	f["toJSONPretty"] = DataNS().ToJSONPretty
	f["toYAML"] = DataNS().ToYAML
	f["toTOML"] = DataNS().ToTOML
	f["toCSV"] = DataNS().ToCSV
}
708150
func (f *Forwarder) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error {
	points = f.FilterDatapoints(points)
	f.mu.Lock()
	defer f.mu.Unlock()
	atomic.AddInt64(&f.stats.totalDatapointsForwarded, int64(len(points)))
	for _, dp := range points {
		if _, err := f.writeString(f.file, dp.String()+"\n"); err != nil {
			return errors.Annotate(err, "cannot write datapoint to string")
		}
	}
	return f.file.Sync()
}
1095301
func (s *PutRecordInput) SetData(v []byte) *PutRecordInput {
	s.Data = v
	return s
}
34397
func (c *Counter) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {
	atomic.AddInt64(&c.TotalDatapoints, int64(len(points)))
	atomic.AddInt64(&c.TotalProcessCalls, 1)
	atomic.AddInt64(&c.CallsInFlight, 1)
	start := time.Now()
	err := next.AddDatapoints(ctx, points)
	atomic.AddInt64(&c.TotalProcessTimeNs, time.Since(start).Nanoseconds())
	atomic.AddInt64(&c.CallsInFlight, -1)
	if err != nil {
		atomic.AddInt64(&c.TotalProcessErrors, 1)
		atomic.AddInt64(&c.ProcessErrorPoints, int64(len(points)))
		c.logErrMsg(ctx, err, "Unable to process datapoints")
	}
	return err
}
967880
func (streamer *Demultiplexer) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint) error {
	if len(points) == 0 {
		return nil
	}
	streamer.handleLateOrFuturePoints(points)
	var errs []error
	for _, sendTo := range streamer.DatapointSinks {
		if err := sendTo.AddDatapoints(ctx, points); err != nil {
			errs = append(errs, err)
		}
	}
	return errors.NewMultiErr(errs)
}
1125603
func (s *RawMessage) SetData(v []byte) *RawMessage {
	s.Data = v
	return s
}
1052495
func (w *WithDimensions) AddDatapoints(ctx context.Context, points []*datapoint.Datapoint, next Sink) error {
	return next.AddDatapoints(ctx, w.appendDimensions(points))
}
515586
func (s *Row) SetData(v []*Datum) *Row {
	s.Data = v
	return s
}
1094273
func (s *Job) SetData(v *JobData) *Job {
	s.Data = v
	return s
}
402728
func (Encoder) AppendObjectData(dst []byte, o []byte) []byte {
	// Two conditions we want to put a ',' between existing content and
	// new content:
	// 1. new content starts with '{' - which shd be dropped   OR
	// 2. existing content has already other fields
	if o[0] == '{' {
		o[0] = ','
	} else if len(dst) > 1 {
		dst = append(dst, ',')
	}
	return append(dst, o...)
}
1250801
func (s *SyncedSet) Add(datas ...interface{}) {
	s.Lock()
	defer s.Unlock()
	for _, data := range datas {
		s.set[data] = true
	}
}
303678
func (p *Params) AddMetadata(key, value string) {
	if p.Metadata == nil {
		p.Metadata = make(map[string]string)
	}

	p.Metadata[key] = value
}
998135
func putData(c *cloudwatch.CloudWatch, metrics []cloudwatch.MetricDatum) (result *aws.BaseResponse, err error) {
	// Serialize the params
	params := aws.MakeParams("PutMetricData")
	for i, metric := range metrics {
		prefix := "MetricData.member." + strconv.Itoa(i+1)
		if metric.MetricName == "" {
			err = fmt.Errorf("no metric name supplied for metric: %d", i)
			return
		}
		params[prefix+".MetricName"] = metric.MetricName
		if metric.Unit != "" {
			params[prefix+".Unit"] = metric.Unit
		}
		if metric.Value != 0 {
			params[prefix+".Value"] = strconv.FormatFloat(metric.Value, 'f', -1, 64)
		}
		if !metric.Timestamp.IsZero() {
			params[prefix+".Timestamp"] = metric.Timestamp.UTC().Format(time.RFC3339)
		}
		for j, dim := range metric.Dimensions {
			dimprefix := prefix + ".Dimensions.member." + strconv.Itoa(j+1)
			params[dimprefix+".Name"] = dim.Name
			params[dimprefix+".Value"] = dim.Value
		}
		if len(metric.StatisticValues) == 1 {
			stat := metric.StatisticValues[0]
			statprefix := prefix + ".StatisticValues"
			params[statprefix+".Maximum"] = strconv.FormatFloat(stat.Maximum, 'f', -1, 64)
			params[statprefix+".Minimum"] = strconv.FormatFloat(stat.Minimum, 'f', -1, 64)
			params[statprefix+".SampleCount"] = strconv.FormatFloat(stat.SampleCount, 'f', -1, 64)
			params[statprefix+".Sum"] = strconv.FormatFloat(stat.Sum, 'f', -1, 64)
		}
	}
	result = new(aws.BaseResponse)
	err = query(c, "POST", "/", params, result)
	return
}
388655
func (s *PostToConnectionInput) SetData(v []byte) *PostToConnectionInput {
	s.Data = v
	return s
}