// ListCharts lists all charts in a given Librato Space.
//
// Librato API docs: http://dev.librato.com/v1/get/spaces/:id/charts
963326
func (s *SpacesService) ListCharts(spaceID uint) ([]SpaceChart, *http.Response, error) {
	u := fmt.Sprintf("spaces/%d/charts", spaceID)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	charts := new([]SpaceChart)
	resp, err := s.client.Do(req, charts)
	if err != nil {
		return nil, resp, err
	}

	return *charts, resp, err
}
711995
func (c *ScatterChart) Plot(g Graphics) {
	layout := layout(g, c.Title, c.XRange.Label, c.YRange.Label,
		c.XRange.TicSetting.Hide || c.XRange.TicSetting.HideLabels,
		c.YRange.TicSetting.Hide || c.YRange.TicSetting.HideLabels,
		&c.Key)

	width, height := layout.Width, layout.Height
	topm, leftm := layout.Top, layout.Left
	numxtics, numytics := layout.NumXtics, layout.NumYtics

	// fmt.Printf("\nSet up of X-Range (%d)\n", numxtics)
	c.XRange.Setup(numxtics, numxtics+2, width, leftm, false)
	// fmt.Printf("\nSet up of Y-Range (%d)\n", numytics)
	c.YRange.Setup(numytics, numytics+2, height, topm, true)

	g.Begin()

	if c.Title != "" {
		drawTitle(g, c.Title, elementStyle(c.Options, TitleElement))
	}

	g.XAxis(c.XRange, topm+height, topm, c.Options)
	g.YAxis(c.YRange, leftm, leftm+width, c.Options)

	// Plot Data
	xf, yf := c.XRange.Data2Screen, c.YRange.Data2Screen
	xmin, xmax := c.XRange.Min, c.XRange.Max
	ymin, ymax := c.YRange.Min, c.YRange.Max
	spf := screenPointFunc(xf, yf, xmin, xmax, ymin, ymax)

	for i, data := range c.Data {
		style := data.Style
		if data.Samples != nil {
			// Samples
			points := make([]EPoint, 0, len(data.Samples))
			for _, d := range data.Samples {
				if d.X < xmin || d.X > xmax || d.Y < ymin || d.Y > ymax {
					continue
				}
				p := spf(d)
				points = append(points, p)
			}
			g.Scatter(points, data.PlotStyle, style)
		} else if data.Func != nil {
			c.drawFunction(g, i)
		}
	}

	if !c.Key.Hide {
		g.Key(layout.KeyX, layout.KeyY, c.Key, c.Options)
	}

	g.End()
}
1005047
func (*Service) ListPlatforms(c context.Context, req *crimson.ListPlatformsRequest) (*crimson.ListPlatformsResponse, error) {
	platforms, err := listPlatforms(c, req)
	if err != nil {
		return nil, err
	}
	return &crimson.ListPlatformsResponse{
		Platforms: platforms,
	}, nil
}
1294866
func (ix *Index) listAt(off uint32) (trigram, count, offset uint32) {
	d := ix.slice(ix.postIndex+off, postEntrySize)
	trigram = uint32(d[0])<<16 | uint32(d[1])<<8 | uint32(d[2])
	count = binary.BigEndian.Uint32(d[3:])
	offset = binary.BigEndian.Uint32(d[3+4:])
	return
}
31626
func (charts *ChartData) Chart(chartID, zoomString string) ([]byte, error) {
	zoom := ParseZoom(zoomString)
	cache, found, cacheID := charts.getCache(chartID, zoom)
	if found && cache.cacheID == cacheID {
		return cache.data, nil
	}
	maker, hasMaker := chartMakers[chartID]
	if !hasMaker {
		return nil, UnknownChartErr
	}
	// Do the locking here, rather than in encodeXY, so that the helper functions
	// (accumulate, btw) are run under lock.
	charts.mtx.RLock()
	data, err := maker(charts, zoom)
	charts.mtx.RUnlock()
	if err != nil {
		return nil, err
	}
	charts.cacheChart(chartID, zoom, data)
	return data, nil
}
1349683
func (s *EventService) ListEvents(p *ListEventsParams) (*ListEventsResponse, error) {
	resp, err := s.cs.newRequest("listEvents", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListEventsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
82118
func (pdb *protoBroker) ListValues(key string) (keyval.ProtoKeyValIterator, error) {
	return listValuesProtoInternal(pdb.broker, pdb.serializer, key)
}
366808
func (api userApi) GetWeeklyTrackChart(args map[string]interface{}) (result UserGetWeeklyTrackChart, err error) {
	defer func() { appendCaller(err, "lastfm.User.GetWeeklyTrackChart") }()
	err = callGet("user.getweeklytrackchart", api.params, args, &result, P{
		"plain": []string{"user", "from", "to"},
	})
	return
}
411316
func NewPieChart() *PieChart {
	return &PieChart{
		Block:       *NewBlock(),
		Colors:      Theme.PieChart.Slices,
		AngleOffset: piechartOffsetUp,
	}
}
294851
func (s *GuestOSService) ListOsCategories(p *ListOsCategoriesParams) (*ListOsCategoriesResponse, error) {
	resp, err := s.cs.newRequest("listOsCategories", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListOsCategoriesResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1016348
func (c *CloudPersister) ListMaps() ([]*models.Map, error) {
	ctx := context.Background()
	Maps := make([]*models.Map, 0)
	q := datastore.NewQuery("Map")

	keys, err := c.DatastoreClient().GetAll(ctx, q, &Maps)

	if err != nil {
		return nil, fmt.Errorf("datastoredb: could not list Maps: %v", err)
	}

	for i, k := range keys {
		Maps[i].ID = k.ID()
	}

	return Maps, nil
}
1102104
func All(basedir string, values []byte, namespace string, strict bool) support.Linter {
	// Using abs path to get directory context
	chartDir, _ := filepath.Abs(basedir)

	linter := support.Linter{ChartDir: chartDir}
	rules.Chartfile(&linter)
	rules.Values(&linter)
	rules.Templates(&linter, values, namespace, strict)
	return linter
}
272363
func NewTimeSeries(timeFormat string) *Chart {
	n := 0
	return &Chart{
		Data: &Data{X: "x", XFormat: timeFormat},
		Axis: map[string]*Axis{
			"x": &Axis{Type: "timeseries", Tick: &Tick{Format: timeFormat, Count: 5}},
			"y": &Axis{Min: &n}, // use pointer to 0
		},
	}
}
290134
func (c *UserController) ListSpaces(ctx *app.ListSpacesUserContext) error {
	client, err := newAuthClient(ctx, c.config, c.httpOptions...)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	res, err := client.ListResourcesUser(goasupport.ForwardContextRequestID(ctx), authservice.ListResourcesUserPath(), authorization.ResourceTypeSpace)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err.Error(),
		}, "unable to get spaces with a role from the auth service")
		return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "unable to get spaces with a role from the auth service"))
	}
	defer rest.CloseResponse(res)

	switch res.StatusCode {
	case 200:
	// OK
	case 401:
		return jsonapi.JSONErrorResponse(ctx, errors.NewUnauthorizedError(rest.ReadBody(res.Body)))
	default:
		return jsonapi.JSONErrorResponse(ctx, errors.NewInternalError(ctx, errs.Errorf("status: %s, body: %s", res.Status, rest.ReadBody(res.Body))))
	}

	spaces, err := client.DecodeUserResourcesList(res)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err.Error(),
		}, "unable to decode spaces with a role from the auth service")
		return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "unable to decode spaces with a role from the auth service"))
	}
	result, err := convertToUserSpaces(ctx, ctx.Request, c.db, spaces)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err.Error(),
		}, "unable to returns spaces with a role from the auth service")
		return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "unable to return spaces with a role from the auth service"))
	}
	return ctx.OK(result)
}
1291335
func (f *File) drawChartDLbls(formatSet *formatChart) *cDLbls {
	return &cDLbls{
		ShowLegendKey:   &attrValBool{Val: formatSet.Legend.ShowLegendKey},
		ShowVal:         &attrValBool{Val: formatSet.Plotarea.ShowVal},
		ShowCatName:     &attrValBool{Val: formatSet.Plotarea.ShowCatName},
		ShowSerName:     &attrValBool{Val: formatSet.Plotarea.ShowSerName},
		ShowBubbleSize:  &attrValBool{Val: formatSet.Plotarea.ShowBubbleSize},
		ShowPercent:     &attrValBool{Val: formatSet.Plotarea.ShowPercent},
		ShowLeaderLines: &attrValBool{Val: formatSet.Plotarea.ShowLeaderLines},
	}
}
1220001
func (s *GistsService) ListAll(ctx context.Context, opt *GistListOptions) ([]*Gist, *Response, error) {
	u, err := addOptions("gists/public", opt)
	if err != nil {
		return nil, nil, err
	}

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var gists []*Gist
	resp, err := s.client.Do(ctx, req, &gists)
	if err != nil {
		return nil, resp, err
	}

	return gists, resp, nil
}
875288
func (api tagApi) GetTopWeeklyChartList(args map[string]interface{}) (result TagGetWeeklyChartList, err error) {
	defer func() { appendCaller(err, "lastfm.Tag.GetWeeklyChartList") }()
	err = callGet("tag.getweeklychartlist", api.params, args, &result, P{
		"plain": []string{"tag"},
	})
	return
}