# Xy graph multiple automatic series

**URL:** <https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343>\
**Category:** Grafana\
**Tags:** xy-panel\
**Created:** [April 13, 2024, 3:54pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343 "2024-04-13T15:54:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hello1ae5](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hello1ae5](https://community.grafana.com/u/hello1ae5)\
**Post date:** [April 13, 2024, 3:54pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/1 "2024-04-13T15:54:57Z")

</div>

Hi,

I am using the BigQuery connector to try and create an x y graph with days since release as the x and number of events as the x

I want each of the possible sources (source colum) to be there own series

I tried with the “Partition by values” transform and it works but i need to set up each series manually. The sources can change so it not ideal to have to keep updating

Is there a way to have a series per source automatically?

My sql is below:

```auto
    SELECT
      source,
      days_since_release,
      num_events
   FROM
  `table`

ORDER BY
  days_since_release

```

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [April 13, 2024, 4:08pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/2 "2024-04-13T16:08:28Z")

</div>

Welcome to forum @hello1ae5  
Try

```auto
SELECT
      source as metric,
      days_since_release as [time],
      num_events as value 
   FROM
  `table`

ORDER BY
  days_since_release

```

And make sure the Format is time series and not table

---

<div class="post-metadata">

**Author:** ![hello1ae5](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hello1ae5](https://community.grafana.com/u/hello1ae5)\
**Post date:** [April 13, 2024, 4:15pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/3 "2024-04-13T16:15:15Z")

</div>

i get a query syntax error with [time], is this still on the xy graph type?

days\_since\_release is just a number not a date

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [April 13, 2024, 5:43pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/4 "2024-04-13T17:43:59Z")

</div>

Do you want a time series graph?  
Which column is date time

---

<div class="post-metadata">

**Author:** ![hello1ae5](https://avatars.discourse-cdn.com/v4/letter/h/91b2a8/32.png) [@hello1ae5](https://community.grafana.com/u/hello1ae5)\
**Post date:** [April 13, 2024, 5:55pm UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/5 "2024-04-13T17:55:00Z")

</div>

No i dont have a datetime field, which is why i thought the xy chart was the best choice

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [April 14, 2024, 12:21am UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/6 "2024-04-14T00:21:27Z")

</div>

duh apologies, you need to pivot your data either like this

```auto
SELECT days_since_release,
      [Vader III], [Sith V] 
   FROM (
    select 'Vader III' as source,
    34 days_since_release,
    232 num_events
    union
    select 'Vader III' as source,
    32 days_since_release,
    123 num_events
  union
   select 'Vader III' as source,
    34 days_since_release,
    232 num_events
    union
    select 'Vader III' as source,
    30 days_since_release,
    100 num_events
    union
    select 'Sith V' as source,
    3 days_since_release,
    22 num_events
    
    ) AS SourceTable  
PIVOT  
(  
  MAX(num_events)  
  FOR [source] IN ([Vader III], [Sith V],)  
) AS PivotTable;  

```

As you can see below the plugin wigs out and puts a metric as an Y value, which is incorrect.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/4/6/46304b3417a1580cd26b2f00332547fc8f993431.png)

or use apache echart multi line xy chart

> **[Examples - Apache ECharts](https://echarts.apache.org/examples/en/editor.html?c=line-stack)**
>
> Apache ECharts, a powerful, interactive charting and visualization library for browser

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [October 9, 2024, 1:24am UTC](https://community.grafana.com/t/xy-graph-multiple-automatic-series/119343/7 "2024-10-09T01:24:43Z")

</div>


