# How to create multiple titles in Vega

**URL:** <https://discuss.elastic.co/t/how-to-create-multiple-titles-in-vega/233630>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [May 20, 2020, 11:29pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-titles-in-vega/233630 "2020-05-20T23:29:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)\
**Post date:** [May 20, 2020, 11:29pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-titles-in-vega/233630/1 "2020-05-20T23:29:15Z")

</div>

Hi,

I'm interested in making the trending chart from this page:[https://www.elastic.co/blog/custom-vega-visualizations-in-kibana](https://www.elastic.co/blog/custom-vega-visualizations-in-kibana)

I'm not only creating one trendline, but I'm tracking several different trends at the same time and so I imported a couple more fields into vega to make those calculations. The only thing left is that I have 4 different trends that I'm tracking and I'd like to have a title to designate what the number means for each of the 4 trends I have. If I have multiple "marks" how can I create a title for each?

 ![Screen Shot 2020-05-20 at 4.25.54 PM](https://us1.discourse-cdn.com/elastic/original/3X/d/4/d42fd7d8f2b0432246149cae660e0b41be175a6f.png)

This is my code:

````auto
marks: [
    {

      type: text
      # Text mark executes once for each of the values in the results,
      # but results has just one value in it. We could have also used it
      # to draw a list of values.
      from: {data: "results"}
      encode: {
        update: {
    
          # Combine the symbol, last value, and the formatted percentage
          # change into a string
          text: {
            signal: "datum.s1w1symbol + ' ' + format(datum.s1w1last, '%') + ' ('+ format(datum.s1w1percentChange, '+.1%') + ')'"
      
          }
          # decide which color to use, depending on the value
          # being up, down, or unchanged
          fill: {
            signal: if(datum.s1w1up, '#00ff00', if(datum.s1w1down, '#ff0000', '#0000ff'))

          }
          # positioning the text in the center of the window
          align: {value: "center"}
          baseline: {value: "middle"}
          xc: {signal: "width/2"}
          yc: {signal: "height/4"}
        
          # Make the size of the font adjust with the size of the visualization
          fontSize: {signal: "min(width/10, height)/1.3"}
          
        }
      }
    },
    {

      type: text
      # Text mark executes once for each of the values in the results,
      # but results has just one value in it. We could have also used it
      # to draw a list of values.
      from: {data: "results"}
      encode: {
        update: {
    
          # Combine the symbol, last value, and the formatted percentage
          # change into a string
          text: {
            signal: "datum.s1w2symbol + ' ' + format(datum.s1w2last, '%') + ' ('+ format(datum.s1w2percentChange, '+.1%') + ')'"
      
          }
          # decide which color to use, depending on the value
          # being up, down, or unchanged
          fill: {
            signal: if(datum.s1w2up, '#00ff00', if(datum.s1w2down, '#ff0000', '#0000ff'))

          }
          # positioning the text in the center of the window
          align: {value: "center"}
          baseline: {value: "middle"}
          xc: {signal: "width/2"}
          yc: {signal: "height/2"}
        
          # Make the size of the font adjust with the size of the visualization
          fontSize: {signal: "min(width/10, height)/1.3"}
          
        }
      }
    }
...
    ```
````

---

<div class="post-metadata">

**Author:** ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)\
**Post date:** [May 21, 2020, 6:35pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-titles-in-vega/233630/2 "2020-05-21T18:35:22Z")

</div>

If anyone has any guidance, it's really appreciated!

---

<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:** [June 18, 2020, 6:35pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-titles-in-vega/233630/3 "2020-06-18T18:35:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
