{"id":3889,"date":"2021-10-14T20:48:17","date_gmt":"2021-10-14T20:48:17","guid":{"rendered":"https:\/\/ionicframework.com\/blog\/?p=3889"},"modified":"2023-01-21T00:31:40","modified_gmt":"2023-01-21T05:31:40","slug":"building-with-stencil-bar-chart","status":"publish","type":"post","link":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart","title":{"rendered":"Building with Stencil: Bar Chart"},"content":{"rendered":"<h2>Creating a Bar Chart Web Component with Stencil<\/h2>\n<p>There are a number of very robust charting libraries on the market. Some are commercial. Some are free. You should use them. Every once in a while though, you need to roll your own. Not to worry! With a splash of SVG and helping hand from <a href=\"https:\/\/stenciljs.com\/\">Stencil<\/a>, you can create a chart as a web component for all to use.<\/p>\n<p><!--more--><\/p>\n<h3>The Array of Data<\/h3>\n<p>Most chart libraries can get pretty complex. Most of that has to do with abstracting how data is represented. Those abstractions are what make the library so useful in so many cases. In this case however, we are not building a library for all the cases, we are building a bar chart to meet our specific case. This can simplify our work dramatically.<\/p>\n<p>According to Wikipedia, in a bar chart &#8220;One axis of the chart shows the specific categories being compared, and the other axis represents a measured value.&#8221; According to me, a bar chart is an array of numbers. Let us start there, with some SVG and an array of numbers.<\/p>\n<pre><code class=\"language-jsx\">import { Component, h, Prop } from &#039;@stencil\/core&#039;;\n\n@Component( {\n  tag: &#039;ionx-chart&#039;,\n  styleUrl: &#039;chart.css&#039;,\n  shadow: true\n} )\nexport class Chart {\n  render() {\n    return (\n      &lt;svg width=&quot;320&quot; height=&quot;240&quot;&gt;&lt;\/svg&gt;\n    );\n  }\n\n  \/\/ Values to use in the chart\n  @Prop() data: Array&lt;number&gt; = [];  \n}\n<\/code><\/pre>\n<p>Each <code>number<\/code> in the <code>Array<\/code> is going to take up the same amount of space along one of the axes. For this example, we will use the horizontal axis. The horizontal axis is <code>320<\/code> pixels across. If we get ten (10) values in the <code>Array<\/code>, each bar will take up <code>32<\/code> pixels.<\/p>\n<h3>The Maximum Ratio<\/h3>\n<p>Believe it or not, we are almost there. The last piece of information we need to know before we can render the chart is the largest (maximum) value (number) in the <code>Array<\/code>. We need to know the maximum because we are looking to establish a ratio. We want the maximum value in the <code>Array<\/code> to equal the available number of pixels we have along the vertical axis.<\/p>\n<pre><code class=\"language-ts\">private ratio: number = 1;\n<\/code><\/pre>\n<p>For example, if the values in the array are all larger than the <code>240<\/code> pixels we have along the vertical axis, how do we render the bar? Let us say the maximum value in the <code>Array<\/code> is <code>1,000<\/code>. The available space we have <code>240<\/code> divided by the maximum value of <code>1,000<\/code> gives us a ratio of <code>240:1,000<\/code> or <code>0.24<\/code>. Now we can multiply any <code>number<\/code> in the <code>Array<\/code> by <code>0.24<\/code>, and we will know the height of the bar <strong>and<\/strong> that bar will fit in our viewable area.<\/p>\n<blockquote><p>\n  Do not believe me? Let us say that the next <code>number<\/code> in the <code>Array<\/code> is <code>500<\/code>. The value of <code>500<\/code> is half of <code>1,000<\/code>. If <code>1,000<\/code> equals all our vertical pixels (<code>240<\/code>),  then <code>500<\/code> should equal half our vertical pixels, or <code>120<\/code>. Ready for this? <code>500 * 0.24 = 120<\/code><\/p><\/blockquote>\n<h3>The Will Render<\/h3>\n<p>Before we render the <code>data<\/code> we will need a place to figure out that maximum value and corresponding ratio. The best place for that from a Stencil perspective is in <code>componentWillRender()<\/code>, which is called before each render.<\/p>\n<pre><code class=\"language-ts\">componentWillRender() {\n  let maximum: number = 0;\n\n  \/\/ Find the largest value\n  for( let d: number = 0; d &lt; this.data.length; d++ )\n    maximum = Math.max( maximum, this.data[d] );\n\n  \/\/ Round up to nearest whole number\n  \/\/ Assign the ratio\n  maximum.= Math.ceil( maximum );\n  this.ratio = 240 \/ maximum;\n}\n<\/code><\/pre>\n<p>It should become pretty clear, pretty quickly, that the limiting factor of our chart, and indeed any chart, is the amount of data to render. Not because rendering takes a long time, but because figuring out the edges of our data does. This is why supercomputers have to be used for weather maps, when all you see is some colored splotches.<\/p>\n<p>A bar chart however, is not a weather map. We can do all this processing (and a considerable amount more) right here in the browser.<\/p>\n<h3>The Render<\/h3>\n<p>Now we have all the pertinent pieces of information, we need to put those bars on the screen! A bar in SVG is a <code>rect<\/code>. The <code>rect<\/code> needs to know where it is positioned (<code>x<\/code>, <code>y<\/code>)  and its dimensions (<code>width<\/code>, <code>height<\/code>).<\/p>\n<p>The <code>height<\/code> we already know will be the value (number) in this iteration of the <code>data<\/code> multiplied by the <code>ratio<\/code> we calculated earlier. We also talked about how the <code>width<\/code> of each bar is the amount of space we have along the horizontal axis (<code>320<\/code>) divided by the number of values in the <code>data<\/code>. We do not know how many values that will be, so we calculate it inline.<\/p>\n<p>The <code>x<\/code> position is almost identical, except we multiply the <code>width<\/code> by the <code>index<\/code> of the iteration. If the <code>width<\/code> is <code>50<\/code> pixels, the first iteration (<code>index === 0<\/code>) will result in <code>x<\/code> being zero (0). Yes, please! The next iteration (<code>index === 1<\/code>) multiplied by a <code>width<\/code> of <code>50<\/code> places <code>x<\/code> at <code>50<\/code>. Exactly!<\/p>\n<pre><code class=\"language-jsx\">render() {\n  return (\n    &lt;svg width=&quot;320&quot; height=&quot;240&quot;&gt;\n      {this.data.map( ( value: number, index: number ) =&gt;\n        &lt;rect \n          fill={`rgb( \n            ${Math.floor( Math.random() * 255)}, \n            ${Math.floor( Math.random() * 255)},\n            ${Math.floor( Math.random() * 255)} \n          )`}\n          x={( 320 \/ this.data.length )  * index}\n          y={240 - ( value * this.ratio )}\n          width={320 \/ this.data.length}\n          height={value * this.ratio} \/&gt;\n      ) }\n    &lt;\/svg&gt;\n  );\n}\n<\/code><\/pre>\n<p>The only one that is a little tricky in SVG-land is the <code>y<\/code> position. When we think of the Web, we generally think of the top-left of the screen as being (<code>0, 0<\/code>) on the coordinate system.  In the case of SVG however (<code>0, 0<\/code>) is at the bottom left.<\/p>\n<p>This means that if we placed <code>y<\/code> at <code>240<\/code> and then said the <code>height<\/code> of the <code>rect<\/code> was <code>100<\/code>, the resulting <code>rect<\/code> would actually be drawn off the SVG viewport (from <code>240<\/code> to <code>340<\/code>). In order to offset this, we subtract the calculated <code>height<\/code> using our <code>ratio<\/code>, from the <code>height<\/code> of the viewable area of the SVG.<\/p>\n<p>In order to see each bar, the <code>fill<\/code> is a randomly generated CSS <code>rgb()<\/code> value. This kind of begs the question &#8220;Maybe the bar should be abstracted into a class that includes fill color?&#8221; Yup! And congratulations on coming full circle &#8211; that is exactly what the charting libraries do; abstract all the things. How far you go with it is up to you.<\/p>\n<h3>\u270b But What About &#8230;<\/h3>\n<p>There are two examples included in the running <a href=\"http:\/\/temp.kevinhoyt.com\/ionic\/chart\/\">demonstration<\/a>, and the GitHub <a href=\"https:\/\/github.com\/krhoyt\/Ionic\/tree\/master\/chart\">repository<\/a>. One example is the chart that we have just created. The other example is a chart that includes many of the typical considerations you might find in a chart.<\/p>\n<ul>\n<li>Chart title<\/li>\n<li>Axis labels<\/li>\n<li>Value labels<\/li>\n<li>Dynamic fill<\/li>\n<li>Rounded corners<\/li>\n<li>Flexible sizing<\/li>\n<li>CSS properties<\/li>\n<\/ul>\n<p>The code is not abstracted to the point of a library, but it should give you a starting place to consider more sophisticated rendering situations for your own chart component.<\/p>\n<h3>Next Steps: Building more web components with Stencil<\/h3>\n<p>All of these options definitely add complexity to the math and rendering, but it all follows the same pattern. First, figure out the structure of the data. Second, figure out the edges of the data. Third, consider any information you might need to calculate for layout. Finally, iterate over the data to render your output.<\/p>\n<p>Now the next time you need a custom chart, you will know where to start &#8211; with Stencil and a web component.<\/p>\n<p><a href=\"https:\/\/ionicframework.com\/blog\/announcing-stencil-v2-9\/\">Stencil v2.9 is here<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a Bar Chart Web Component with Stencil There are a number of very robust charting libraries on the market. Some are commercial. Some are free. You should use them. Every once in a while though, you need to roll your own. Not to worry! With a splash of SVG and helping hand from Stencil, [&hellip;]<\/p>\n","protected":false},"author":85,"featured_media":3890,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"publish_to_discourse":"0","publish_post_category":"23","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"534676","discourse_permalink":"https:\/\/forum.ionicframework.com\/t\/building-with-stencil-bar-chart\/216163","wpdc_publishing_response":"","wpdc_publishing_error":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[223,124],"tags":[140,76,82],"class_list":["post-3889","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-stencil","category-tutorials","tag-design-systems","tag-stencil","tag-web-components"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Building with Stencil: Bar Chart web component | Ionic blog<\/title>\n<meta name=\"description\" content=\"Learn how to build a bar chart web component using Stencil: Ionic&#039;s toolchain for building reusable, scalable Design Systems.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building with Stencil: Bar Chart\" \/>\n<meta property=\"og:description\" content=\"Learn how to build a bar chart web component using Stencil: Ionic&#039;s toolchain for building reusable, scalable Design Systems.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\" \/>\n<meta property=\"og:site_name\" content=\"Ionic Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-14T20:48:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-21T05:31:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"880\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kevin Hoyt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:site\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kevin Hoyt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#article\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\"},\"author\":{\"name\":\"Kevin Hoyt\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/5cf8e478fa22da64450a7292b5596c81\"},\"headline\":\"Building with Stencil: Bar Chart\",\"datePublished\":\"2021-10-14T20:48:17+00:00\",\"dateModified\":\"2023-01-21T05:31:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\"},\"wordCount\":1010,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png\",\"keywords\":[\"Design Systems\",\"stencil\",\"web components\"],\"articleSection\":[\"Stencil\",\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\",\"url\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\",\"name\":\"Building with Stencil: Bar Chart web component | Ionic blog\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png\",\"datePublished\":\"2021-10-14T20:48:17+00:00\",\"dateModified\":\"2023-01-21T05:31:40+00:00\",\"description\":\"Learn how to build a bar chart web component using Stencil: Ionic's toolchain for building reusable, scalable Design Systems.\",\"breadcrumb\":{\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png\",\"width\":1600,\"height\":880},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ionic.io\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building with Stencil: Bar Chart\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ionic.io\/blog\/#website\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"name\":\"ionic.io\/blog\",\"description\":\"Build amazing native and progressive web apps with the web\",\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ionic.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ionic.io\/blog\/#organization\",\"name\":\"Ionic\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"width\":1920,\"height\":854,\"caption\":\"Ionic\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ionicframework\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/5cf8e478fa22da64450a7292b5596c81\",\"name\":\"Kevin Hoyt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/07\/2520666-150x150.jpg\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/07\/2520666-150x150.jpg\",\"caption\":\"Kevin Hoyt\"},\"url\":\"https:\/\/ionic.io\/blog\/author\/hoyt\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Building with Stencil: Bar Chart web component | Ionic blog","description":"Learn how to build a bar chart web component using Stencil: Ionic's toolchain for building reusable, scalable Design Systems.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart","og_locale":"en_US","og_type":"article","og_title":"Building with Stencil: Bar Chart","og_description":"Learn how to build a bar chart web component using Stencil: Ionic's toolchain for building reusable, scalable Design Systems.","og_url":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart","og_site_name":"Ionic Blog","article_published_time":"2021-10-14T20:48:17+00:00","article_modified_time":"2023-01-21T05:31:40+00:00","og_image":[{"width":1600,"height":880,"url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","type":"image\/png"}],"author":"Kevin Hoyt","twitter_card":"summary_large_image","twitter_creator":"@ionicframework","twitter_site":"@ionicframework","twitter_misc":{"Written by":"Kevin Hoyt","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#article","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart"},"author":{"name":"Kevin Hoyt","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/5cf8e478fa22da64450a7292b5596c81"},"headline":"Building with Stencil: Bar Chart","datePublished":"2021-10-14T20:48:17+00:00","dateModified":"2023-01-21T05:31:40+00:00","mainEntityOfPage":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart"},"wordCount":1010,"commentCount":0,"publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"image":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","keywords":["Design Systems","stencil","web components"],"articleSection":["Stencil","Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart","url":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart","name":"Building with Stencil: Bar Chart web component | Ionic blog","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage"},"image":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage"},"thumbnailUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","datePublished":"2021-10-14T20:48:17+00:00","dateModified":"2023-01-21T05:31:40+00:00","description":"Learn how to build a bar chart web component using Stencil: Ionic's toolchain for building reusable, scalable Design Systems.","breadcrumb":{"@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#primaryimage","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","width":1600,"height":880},{"@type":"BreadcrumbList","@id":"https:\/\/ionic.io\/blog\/building-with-stencil-bar-chart#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ionic.io\/blog"},{"@type":"ListItem","position":2,"name":"Building with Stencil: Bar Chart"}]},{"@type":"WebSite","@id":"https:\/\/ionic.io\/blog\/#website","url":"https:\/\/ionic.io\/blog\/","name":"ionic.io\/blog","description":"Build amazing native and progressive web apps with the web","publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ionic.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ionic.io\/blog\/#organization","name":"Ionic","url":"https:\/\/ionic.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","width":1920,"height":854,"caption":"Ionic"},"image":{"@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ionicframework"]},{"@type":"Person","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/5cf8e478fa22da64450a7292b5596c81","name":"Kevin Hoyt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/07\/2520666-150x150.jpg","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/07\/2520666-150x150.jpg","caption":"Kevin Hoyt"},"url":"https:\/\/ionic.io\/blog\/author\/hoyt"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2021\/10\/stencil-chart-feature-image.png","_links":{"self":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/3889","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/users\/85"}],"replies":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/comments?post=3889"}],"version-history":[{"count":1,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/3889\/revisions"}],"predecessor-version":[{"id":4712,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/3889\/revisions\/4712"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media\/3890"}],"wp:attachment":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media?parent=3889"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/categories?post=3889"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/tags?post=3889"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}