{"id":696,"date":"2012-10-27T23:22:58","date_gmt":"2012-10-27T23:22:58","guid":{"rendered":"http:\/\/garysieling.com\/blog\/?p=696"},"modified":"2012-10-27T23:22:58","modified_gmt":"2012-10-27T23:22:58","slug":"extjs-3-4-chart-with-logarithmic-axis","status":"publish","type":"post","link":"https:\/\/www.garysieling.com\/blog\/extjs-3-4-chart-with-logarithmic-axis\/","title":{"rendered":"ExtJS 3.4 Scatter Chart Example with Logarithmic Axis"},"content":{"rendered":"<p><strong>Problem<\/strong><\/p>\n<p>You are rendering data that increases exponentially, and wish display a chart with a log-scale axis.<\/p>\n<p>Exponential data:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/172.104.26.128\/wp-content\/uploads\/2012\/10\/linear-scale.png\" alt=\"\" title=\"linear scale data - extjs scatter chart\" width=\"430\" height=\"329\" class=\"alignnone size-full wp-image-701\" srcset=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2012\/10\/linear-scale.png 430w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2012\/10\/linear-scale-300x230.png 300w\" sizes=\"(max-width: 430px) 100vw, 430px\" \/><\/p>\n<p>Logarithmic scale rendering of the same:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/172.104.26.128\/wp-content\/uploads\/2012\/10\/log-scale.png\" alt=\"\" title=\"log scale axis chart - ExtJS 3.4\" width=\"434\" height=\"339\" class=\"alignnone size-full wp-image-697\" srcset=\"https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2012\/10\/log-scale.png 434w, https:\/\/www.garysieling.com\/blog\/wp-content\/uploads\/2012\/10\/log-scale-300x234.png 300w\" sizes=\"(max-width: 434px) 100vw, 434px\" \/><\/p>\n<p><strong>Solution<\/strong><\/p>\n<p>Set the &#8220;scale&#8221; property of the relevant axis to &#8220;logarithmic.&#8221;<\/p>\n<p><strong>Discussion<\/strong><\/p>\n<p>There does not seem to be any way to control the frequency of the major\/minor tick marks other than by fixed intervals. Be careful about setting these in this chart type, as you can quickly overwhelm the browser to the point where Flash is unresponsive. It may be preferable to control the rendering using tooltips on the data points.<\/p>\n<p>For further discussion of similar charts, see the <a href=\"http:\/\/garysieling.com\/blog\/extjs-3-4-scatter-chart-example\">ExtJS scatter chart<\/a> example and <a href=\"http:\/\/garysieling.com\/blog\/extjs-3-4-trendline-example\">ExtJS trend line example<\/a>.<\/p>\n<pre lang=\"javascript\">\nExt.onReady(function() {\nExt.chart.Chart.CHART_URL = 'ext-3.4.0\/resources\/charts.swf';\n   var store = new Ext.data.JsonStore({\n    fields: ['year', 'action'],\n    data: [\n        {year: 2005, action: 100000},\n        {year: 2006, action: 1000000},\n        {year: 2007, action: 10000000},\n        {year: 2008, action: 100000000}\n        ]\n  });\n  \n  new Ext.Panel({\n    width: 390,\n    height: 300,\n    renderTo: 'container',\n    title: 'Scatter Plot - Takings by Genre',\n    items: {\n      xtype: 'linechart',\n      store: store,\n      xField: 'year',\n      xAxis: new Ext.chart.NumericAxis({\n        minimum: 2004,\n        maximum: 2009,\n        majorUnit: 1,\n\n      }),\n      yAxis: new Ext.chart.NumericAxis({\n        labelRenderer: Ext.util.Format.usMoney,\n        minimum: 10,\n        maximum: 1000000000,\n        scale: 'logarithmic'\n      }),\n      series: [{\n        yField: 'action',\n        displayName: 'Action',\n        style: {\n          lineAlpha: 0.0\n        }\n      }]\n    }\n  });\n});\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Problem You are rendering data that increases exponentially, and wish display a chart with a log-scale axis. Exponential data: Logarithmic scale rendering of the same: Solution Set the &#8220;scale&#8221; property of the relevant axis to &#8220;logarithmic.&#8221; Discussion There does not seem to be any way to control the frequency of the major\/minor tick marks other &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.garysieling.com\/blog\/extjs-3-4-chart-with-logarithmic-axis\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;ExtJS 3.4 Scatter Chart Example with Logarithmic Axis&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4],"tags":[154,155,214,217,218,224,240,276,277,302,303,304,316,317,318,319,575],"aioseo_notices":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/696"}],"collection":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/comments?post=696"}],"version-history":[{"count":0,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/posts\/696\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/media?parent=696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/categories?post=696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garysieling.com\/blog\/wp-json\/wp\/v2\/tags?post=696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}