MULTISERIES EXAMPLE - Legend


#1

Hi,
I am trying to set the value for “name” into a series’ item but it seems that something is missing in my code:

public GeckoBarChart CreateGeckoBarChartStat(string serviceName, List<AutoProposalEntity> values)
    {
        List<string> xAxisStrings = new List<string>();

        for (int i = 0; i < values.Count; i++)
            xAxisStrings.Add(values[i].Interval.ToShortTimeString());

        GeckoBarChartXAxis xAxis = new GeckoBarChartXAxis();
        xAxis.Labels = xAxisStrings;

        GeckoBarChart bar = new GeckoBarChart();
        bar.XAxis = xAxis;

        List<GeckoBarChartSeries> seriesList = new List<GeckoBarChartSeries>();

        List<int> serieCreated = new List<int>();
        List<int> serieProcessed = new List<int>();
        List<int> serieResponseReceived = new List<int>();

        for (int i = 0; i < values.Count; i++)
        {
            serieCreated.Add(values[i].Created);
            serieProcessed.Add(values[i].Processed);
            serieResponseReceived.Add(values[i].ResponseReceived);
        }

        GeckoBarChartSeries chartCreated = new GeckoBarChartSeries();
        chartCreated.Data = serieCreated;

        GeckoBarChartSeries chartProcessed = new GeckoBarChartSeries();
        chartProcessed.Data = serieProcessed;

        GeckoBarChartSeries chartResponseReceived = new GeckoBarChartSeries();
        chartResponseReceived.Data = serieResponseReceived;

        seriesList.Add(chartCreated);
        seriesList.Add(chartProcessed);
        seriesList.Add(chartResponseReceived);

        bar.Series = seriesList;

        return bar;
    }

Basically my problem is adding the name to the 2 bars for each item.
Looking at GeckoBarChartSeries object I can’t see any property doing this (as for Data property).
Does anyone able to help me with this?

Thanks,
Rosario.


#2

Hi @Rosario,

I’m afraid multi-series is not yet supported on the dataset’s API. It’s certainly on our radar, but not on the pipeline yet (at least not for this quarter).

At present, multi-series is supported on our Custom Widgets API if that’s an alternative.


#3

Hi @luis ,
I didn’t catch your reply. The code I added on my request is perfectly working but I am not able to:

  • Change for example the color of each bar;
  • Add the name to each bar so the legend would show bar’s names.

Is this possible doing using my code? I was thinking about something like this:


chartCreated.Data = serieCreated;
chartCreated.Name = “”;

But unfortunately the GeckoBarChartSeries object seems do not provide “Name” property as for “Data”.

Thanks,
Ros.


#4

Hey @Rosario, it looks like you’re using this library kfrancis/geckonet I had a look at the source and it looks like the author simply didn’t add the name property to the GeckoBarChartSeries class. This isn’t an official library that Geckoboard maintains, but I or one of my colleagues maybe be able to submit a PR to add that. Or of course, you could create the data structure yourself that when serialized to JSON matches the format here http://developer-custom.geckoboard.com/#multiseries-example


#5

@Rosario Sorry, I’d missed this in my previous answer. The colors of the bars aren’t configurable from the payload.


#6

@Rosario, further to @jaso’s comments. Whilst you cannot control/change the colours on the bar chart, they always follow the same order:

colours bar charts


#7

Hi @jason, many thanks for your help! I saw you have already asked to @kfrancis adding the missing property.
Hopefully this would help other developers as well!

Thanks,
Ros.


#8

Hi @luis, any idea of when multi-series will be available for dataset API as well?

Thanks,
Ros.


#9

@Rosario It is on our radar. Whilst we don’t have a timeframe yet, I’d expect it to be ready within the next 3 months or so. I’ll be happy to let you know as soon as we start working on it :slight_smile:


#10

Hey @Rosario, Kori merged this so you can now use the name property there :slight_smile: https://github.com/kfrancis/geckonet/pull/5