{"id":121,"date":"2007-12-08T15:00:04","date_gmt":"2007-12-08T06:00:04","guid":{"rendered":"http:\/\/www.climb.co.jp\/blog_espress\/archives\/121"},"modified":"2007-12-08T15:00:04","modified_gmt":"2007-12-08T06:00:04","slug":"ver5%e3%81%8b%e3%82%89%e3%81%ae%e3%83%95%e3%82%a9%e3%83%b3%e3%83%88%e3%82%b5%e3%82%a4%e3%82%ba%e3%80%90java%e3%83%81%e3%83%a3%e3%83%bc%e3%83%88%e3%83%bb%e3%82%b0%e3%83%a9%e3%83%95%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.climb.co.jp\/blog_espress\/archives\/121","title":{"rendered":"Ver5\u304b\u3089\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u3010Java\u30c1\u30e3\u30fc\u30c8\u30fb\u30b0\u30e9\u30d5\u4f5c\u6210\u30c4\u30fc\u30ebEspressChart\u3011"},"content":{"rendered":"<p>Ver5\u304b\u3089\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u4ee5\u524d\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u306b\u623b\u3059\u306b\u306f\u4e0b\u8a18\u306e\u30d1\u30c3\u30c1\u3092\u5f53\u3066\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>\/\/ The following lines are used for EC3.8 upgrade test 12\/4\/2007<br \/>chart.setAdjustFont(false);<br \/>chart.gethXAxis().gethLabel().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>chart.gethYAxis().gethLabel().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>chart.gethLegend().gethText().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>\/\/ End of test<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>[\u4e0b\u8a18\u306b\u30b5\u30f3\u30d6\u30eb\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002]<\/p>\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n<p>\/\/ Import all necessary classes<br \/>import quadbase.ChartAPI.*;<br \/>import quadbase.util.*;<br \/>import java.awt.*;<br \/>import java.util.*;<br \/>import java.sql.*;<br \/>import java.applet.Applet;<br \/>import java.io.*;<\/p>\n<p>\/\/ Set up Frame<br \/>public class Scatter10 extends Frame {<br \/>public QbChart chart;<\/p>\n<p>\/\/ Start Frame<br \/>public Scatter10() {<br \/>start();<br \/>}<\/p>\n<p>\/\/ Create Empty Chart and set up initial data and wipe out empty chart data<br \/>public void start() {<\/p>\n<p>QbChart.setChartServerUsed(false);<br \/>setLayout(new BorderLayout());<\/p>\n<p>Timestamp time[] = {new Timestamp(100, 9, 7, 0, 0, 0, 0),<br \/>new Timestamp(100, 9, 8, 0, 0, 0, 0), new Timestamp(100, 9, 9, 0, 0, 0, 0), new Timestamp(100, 9, 10, 0, 0, 0, 0),new Timestamp(100, 9, 7, 0, 0, 0, 0), new Timestamp(100, 9, 8, 0, 0, 0, 0), new Timestamp(100, 9, 9, 0, 0, 0, 0), new Timestamp(100, 9, 10, 0, 0, 0, 0)}; <\/p>\n<p>Integer ctime[]=new Integer[8];<\/p>\n<p>for (int i = 0; i &lt;8; i++) {<br \/>ctime[i] = new Integer( (int) ((time[i].getTime() &#8211; time[0].getTime())\/1000) );<br \/>System.out.println(ctime[i]);<\/p>\n<p>}<br \/>\/\/ use the first field is series <\/p>\n<p>String dataType[] = {&#8220;String&#8221;, &#8220;int&#8221;, &#8220;double&#8221;};<br \/>String fieldName[] = {&#8220;Periods&#8221;, &#8220;ctime&#8221;, &#8220;Demand&#8221;};<\/p>\n<p>String records[][] = {<\/p>\n<p>{&#8220;Cisco&#8221;, ctime[0].toString(), &#8220;6&#8221;},<\/p>\n<p>{&#8220;Cisco&#8221; , ctime[1].toString(), &#8220;5&#8221;},<\/p>\n<p>{&#8220;Cisco&#8221; , ctime[2].toString(), &#8220;2&#8221;},<br \/>{&#8220;Cisco&#8221; , ctime[3].toString(), &#8220;1&#8221;},<\/p>\n<p>{&#8220;Lucent&#8221;, ctime[4].toString(), &#8220;1.5&#8221;},<\/p>\n<p>{&#8220;Lucent&#8221; , ctime[5].toString(), &#8220;2.5&#8221;},<br \/>{&#8220;Lucent&#8221; , ctime[6].toString(), &#8220;3.5&#8221;},<\/p>\n<p>{&#8220;Lucent&#8221; , ctime[7].toString(), &#8220;5.5&#8221;}<\/p>\n<p>};<br \/>DbData data = new DbData(dataType, fieldName, records);<\/p>\n<p>int map[] = {1, 2};<br \/>int thickness[] = {2, 5};<\/p>\n<p>try {<br \/>chart = new QbChart(this, QbChart.VIEW2D,<br \/>QbChart.SCATTER,<br \/>data,<br \/>new ColInfo(0, map), null);<br \/>} catch (Exception ex) {<br \/>System.out.println(&#8220;Cannot create the chart&#8221;);<br \/>ex.printStackTrace();<br \/>return;<br \/>}<\/p>\n<p>\/\/ Set data points<br \/>Color color[] = {Color.green, Color.red};<br \/>IDataPointSet hDataPoints = chart.gethDataPoints();<br \/>hDataPoints.setColors(color);<br \/>hDataPoints.setConnectLinesVisible(true);<br \/>hDataPoints.setDataLineThickness(thickness);<\/p>\n<p>\/\/ The following lines are used for EC3.8 upgrade test 12\/4\/2007<br \/>chart.setAdjustFont(false);<br \/>chart.gethXAxis().gethLabel().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>chart.gethYAxis().gethLabel().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>chart.gethLegend().gethText().setFont(new Font(&#8220;Arial&#8221;, Font.PLAIN, 9));<br \/>\/\/ End of test<\/p>\n<p>\/\/ Set background color<br \/>ICanvas hCanvas = chart.gethCanvas();<br \/>hCanvas.setBackgroundColor(Color.white);<\/p>\n<p>\/\/Move legend<br \/>ILegend legend = chart.gethLegend();<\/p>\n<p>IAxis hXAxis = chart.gethXAxis();<br \/>hXAxis.setScaleAutomatic(false); \/\/ low manual scale<br \/>hXAxis.setMinScale(new Integer(0));<br \/>hXAxis.setMaxScale(new Integer(258200));<br \/>hXAxis.setScaleStep(new Integer(86400));<\/p>\n<p>\/\/ Set label <\/p>\n<p>chart.gethXAxis().gethLabel().setAngle(90);<\/p>\n<p>\/\/ for label replacement purpose replace 0 with 0.0<br \/>NumericFormat xLabel = new NumericFormat();<br \/>xLabel.decimal = 1;<br \/>chart.gethDataPoints().setLabelFormat(1, xLabel);<\/p>\n<p>chart.gethDataPoints().replace(&#8220;0.0&#8221;, &#8220;2000\/9\/7&#8221;);<br \/>chart.gethDataPoints().replace(&#8220;86,400.0&#8221;, &#8220;2000\/9\/8&#8221;);<br \/>chart.gethDataPoints().replace(&#8220;172,800.0&#8221;, &#8220;2000\/9\/9&#8221;);<br \/>chart.gethDataPoints().replace(&#8220;259,200.0&#8221;, &#8220;2000\/9\/10&#8221;);<\/p>\n<p>\/\/ Set YAxis<br \/>IAxis hYAxis = chart.gethYAxis();<\/p>\n<p>this.add (&#8220;Center&#8221;, chart);<\/p>\n<p>try {<br \/>chart.export(QbChart.GIF, &#8220;test&#8221;, 600, 400);<\/p>\n<p>} catch (Exception e1) {<br \/>e1.printStackTrace();<br \/>}<br \/>}<\/p>\n<p>public class FunctionLine1 implements IFunction{ <br \/>public double getY(double x){ <br \/>return (0.001*x + 2); <br \/>} <br \/>}<\/p>\n<p>\/\/Start<br \/>public static void main(String[] args) {<br \/>System.out.println(&#8220;Starting Export now &#8230;&#8221;);<br \/>Scatter10 t = new Scatter10();<br \/>t.resize(600,400);<br \/>t.setVisible(true);<br \/>System.out.println(&#8220;Done Exporting.&#8221;);<br \/>}<br \/>}<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ver5\u304b\u3089\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u304c\u5909\u66f4\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002 \u305d\u308c\u4ee5\u524d\u306e\u30d5\u30a9\u30f3\u30c8 &hellip; <a href=\"https:\/\/www.climb.co.jp\/blog_espress\/archives\/121\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-espresschart"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/comments?post=121"}],"version-history":[{"count":0,"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/posts\/121\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/media?parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/categories?post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.climb.co.jp\/blog_espress\/wp-json\/wp\/v2\/tags?post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}