# Selecting multiple fields to display in a line graph

**URL:** <https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081>\
**Category:** Kibana\
**Created:** [May 26, 2016, 4:42pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081 "2016-05-26T16:42:54Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 4:42pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/1 "2016-05-26T16:42:54Z")

</div>

I was wondering can we select more than 1 field for comparision purposes.

for example, i have 3 line graph, 1 line shows a count of user in los angeles, another count in san jose, and another in colorado.

So i wanted to compare the growth of los angeles and san jose. Can this be done?

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 6:39pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/2 "2016-05-26T18:39:52Z")

</div>

Add an additional Split Lines X-axis bucket?

ie:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/aaffaecdc49b2e5ab6f8362ebbfce5e067b24607.png)

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 6:58pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/3 "2016-05-26T18:58:49Z")

</div>

Note quite what i was thinking. Lets say you created a bar chart along with this line graph with the 3 location.keyword. And say you only wanted to display los angeles and san jose. If you click on the los angeles bar, it'll show the line graph of only los angeles. If you click on san jose, it'll show you the line graph of only san jose . I was thinking if i wanted to see los angeles and san jose only, could that be done? (so clicking on los angeles and san jose). If we were to scale this out to say 1000 locations, with all being similar in count, i thinking being able to select a few and compare would be beneficial.

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 7:35pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/4 "2016-05-26T19:35:28Z")

</div>

Does the search bar meet your needs?

 ![](https://us1.discourse-cdn.com/elastic/original/2X/d/d4f265df90b35496108dd236cd0b644d3e5818ce.png)

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 7:38pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/5 "2016-05-26T19:38:06Z")

</div>

I'm embeding the dashboard. So the search bar isn't available, unless you know how i could embed the searchbar without the (Discover, Visualization, etc..)

Thats another issue that i'm having.

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 7:44pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/6 "2016-05-26T19:44:29Z")

</div>

Are you using a shortened URL? if you aren't, you can build and inject your own search terms right into the url.

`https://localhost:5601/yoj/app/kibana?#/visualize/create?type=line&indexPattern=split_line_graph&_g=(refreshInterval:(display:Off,pause:!f,value:0),time:(from:'2016-05-25T23:51:17.805Z',mode:absolute,to:'2016-05-26T00:00:04.127Z'))&_a=(filters:!(),linked:!f,query:(query_string:(analyze_wildcard:!t,query:'location:!'San%20Jose!'%20OR%20location:!'Colorado!'')),uiState:(),vis:(aggs:!((id:'1',params:(),schema:metric,type:count),(id:'2',params:(customInterval:'2h',extended_bounds:(),field:timestamp,interval:auto,min_doc_count:1),schema:segment,type:date_histogram)),listeners:(),params:(addLegend:!t,addTimeMarker:!f,addTooltip:!t,defaultYExtents:!f,drawLinesBetweenPoints:!t,interpolate:linear,radiusRatio:9,scale:linear,setYExtents:!f,shareYAxis:!t,showCircles:!t,smoothLines:!f,times:!(),yAxis:()),title:'New%20Visualization',type:line))`  
That's my URL, and my search phrase is this bit here:  
`query:'location:!'San%20Jose!'%20OR%20location:!'Colorado!'')`

So if you're embedding this visualization into your own app, then you can build whatever UI that you want, have it generate the search phrase, and embed it into the url.

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 7:50pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/7 "2016-05-26T19:50:55Z")

</div>

But wouldn't doing that take away the ability for the user to select a different location later one. Say at a different time, the user wants to select san jose and colorado.

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 7:52pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/8 "2016-05-26T19:52:36Z")

</div>

I don't follow. You're embedding the visualization into your own app or dashboard, right? You have the ability to modify the url. With that ability you should be able to specify whatever you want the specific values to filter for.

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 8:03pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/9 "2016-05-26T20:03:26Z")

</div>

I'm embedding the dashboard to a host website where the user can click on the different locations. They don't have access to the searchbar where they could enter the commands to display the different combinations.

so say for example, i embed your graph, i would see the line graph for san jose or colorado. From there, if the user wanted to see los angeles and san jose, how can they do that if they only see san jose and colorado...

I might not be following on what you are saying...

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 8:06pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/10 "2016-05-26T20:06:39Z")

</div>

Can you be more specific re: [quote]  
I'm embedding the dashboard to a host website where the user can click on the different locations  
[/quote]  
?

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 8:13pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/11 "2016-05-26T20:13:59Z")

</div>

Sorry, let me see if i can explain it better...

I'm sharing the dashboard without kibana's menus so that users can not edit the graphs, dashboards etc...

The browser that the users are looking at, don't have the kibana's menus. So its read only for them.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 8:22pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/12 "2016-05-26T20:22:43Z")

</div>

It does. I'm interested in the UI that you're presenting to the user to 'click on different locations'.. I envision something like this: (albeit very simplified)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/9/903108e135a05885916c9f96156a5848260b8b22.png)

What I'm saying, is you can use javascript to determine which checkboxes are checked, and dynamically alter the url of your embed object. building and inserting the appropriate search query depending on which options are selected.

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 8:37pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/13 "2016-05-26T20:37:25Z")

</div>

Ah..okay..

So you have 2 graph, a line graph and a bar graph, both representing locations. Lets take your line graph in your example. Same data but with a bar graph (term location) that represents the location. So if the user clicks on bar that represents los angeles, the line graph will reflect just los angles and if the user clicks on bar that represents san jose, the line graph will reflect on san jose only.

It seems without the searchbar where i could type in the command, i can only select one bar at a time. So comparing 2 locations is not possible using this method.

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 8:47pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/14 "2016-05-26T20:47:03Z")

</div>

Can you attach a sketch or screenshot of what you're trying to accomplish?

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 8:53pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/15 "2016-05-26T20:53:45Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/2/23d70f756c9967040fe3e9c8489e361bde45580a.png)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/4/4689adcec9f74ad7d359eb179ec5a29832baa00d.png)

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 8:59pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/16 "2016-05-26T20:59:30Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/b/bcb45139ebd492805c85250aad80344893d30e8d.png)

 ![](https://us1.discourse-cdn.com/elastic/original/2X/5/58454c07b2c9ad67823814041bf0e83f3455d9e0.png)

I can't select 2 bar to show the comparison between say x\_men and starwars. If i had the search bar, i could type in the command....

---

<div class="post-metadata">

**Author:** ![BigFunger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bigfunger/32/7323_2.png) [@BigFunger](https://discuss.elastic.co/u/BigFunger)\
**Post date:** [May 26, 2016, 9:08pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/17 "2016-05-26T21:08:15Z")

</div>

There is no way to just enable the search bar on an embedded dashboard. I think the best that you can do is add controls to your page that allow your users to create search phrases and inject them into the url of your embedded dashboard as I described above.

---

<div class="post-metadata">

**Author:** ![rheng](https://avatars.discourse-cdn.com/v4/letter/r/ccd318/32.png) [@rheng](https://discuss.elastic.co/u/rheng)\
**Post date:** [May 26, 2016, 9:09pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/18 "2016-05-26T21:09:37Z")

</div>

Yea..it looks that...Thanks for help. I appreciate the patience.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:52pm UTC](https://discuss.elastic.co/t/selecting-multiple-fields-to-display-in-a-line-graph/51081/19 "2017-07-06T13:52:11Z")

</div>


