<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Here comes the Sun &#187; html</title>
	<atom:link href="http://sunng.info/blog/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://sunng.info/blog</link>
	<description>47% users on this site use *nix</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:08:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Fix ogg/oga not play in Firefox 3.6</title>
		<link>http://sunng.info/blog/2011/02/fix-oggoga-not-play-in-firefox-3-6/</link>
		<comments>http://sunng.info/blog/2011/02/fix-oggoga-not-play-in-firefox-3-6/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 15:05:44 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[把戏]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/2011/02/fix-oggoga-not-play-in-firefox-3-6/</guid>
		<description><![CDATA[Native audio support was introduced in since Firefox 3.5 . Ogg is one of the media format supported by Firefox. However, sometimes you may find it doesn&#8217;t work even if you set the right source path. And you just check &#8230; <a href="http://sunng.info/blog/2011/02/fix-oggoga-not-play-in-firefox-3-6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Native audio support was introduced in since Firefox 3.5 . Ogg is one of the media format supported by Firefox. However, sometimes you may find it doesn&#8217;t work even if you set the right source path.  And you just check the network status of audio element:</p>
<p><i>document.getElementsByTagName(&#8220;audio&#8221;)[0].networkState</i></p>
<p>Then you get the constant of a 4, which is HTMLMediaElement.NETWORK_NO_SOURCE.</p>
<p>This is because firefox checks the Content-Type header to make sure it&#8217;s a media file. (Webkit based browsers don&#8217;t have this restriction.) However, ogg format is not configured on most http servers. You can check the content type by:<br />
<i>curl -I &lt;url-to-media-file&gt;</i></p>
<p>Take Apache as example, you can add following content to your configuration file:<br />
<i>AddType audio/ogg .oga</i><br />
<i>AddType video/ogg .ogv .ogg</i></p>
<p>For more, check this article:<br />
<a href="https://developer.mozilla.org/en/Configuring_servers_for_Ogg_media">https://developer.mozilla.org/en/Configuring_servers_for_Ogg_media</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2011/02/fix-oggoga-not-play-in-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HTML5 Form in Opera 11</title>
		<link>http://sunng.info/blog/2011/01/html5-form-in-opera-11/</link>
		<comments>http://sunng.info/blog/2011/01/html5-form-in-opera-11/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 15:21:19 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[装备]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[opera]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/2011/01/html5-form-in-opera-11/</guid>
		<description><![CDATA[严格意义上我现在已经不能算是个web guy了，不过托Web开放的特性，咱也能评论一下。最近做个小的界面，考虑到要面向未来，HTML5又提供了丰富的表单增强。这些特性中，Firefox 3.6基本上还没有支持，Chromium 8.0有少部分支持，而真正支持比较完整的是Opera 11. autofocus 页面载入后自动将焦点转到某个input，就如以前的onload时候xxx.focus() required 指定某个input为必填，提交时会有validation，在Opera11里还会给你这样的警告并且禁止提交： email / url 指定某个input的特殊类型，提交时也会有对应的格式检查： 这样的提示可能满足不了你的替用户着想的产品经理，但是你清楚他帮你省了多少事情。而且，在DiveInfoHtml5里提到，iphone甚至为这个input做了优化，在软件盘上把空格键变得很小（因为输入邮件地址用不着），并且提供了一个@键；这就是工程师的用户体验啊。 placeholder 在input里显示提示文本： 注意到后面的红色星号了吗。这本来是我设计的一个workaround，既然Firefox 3都还不支持required validation，那么我们通过CSS来显示一个必填的提示： input&#91;required=&#34;required&#34;&#93;:after &#123; &#160; &#160; content: '(*)'; &#160; &#160; color: #F00; &#125; 结果这个伪类最后只有在Opera里实现了预期的效果，看在Stackoverflow上的讨论才得知input的:after和:before伪类只有Opera支持。 HTML5 Form这部分是一个真正务实的标准，你可以看到几乎每一个特性都是我们日常每时每刻都需要，几乎每个网站的JS都要实现的功能。标准是沟通上下游（浏览器和应用开发人员）的契约，一个真正反应相互需求的标准才是有实际价值的。]]></description>
			<content:encoded><![CDATA[<p>严格意义上我现在已经不能算是个web guy了，不过托Web开放的特性，咱也能评论一下。最近做个小的界面，考虑到要面向未来，HTML5又提供了丰富的表单增强。这些特性中，Firefox 3.6基本上还没有支持，Chromium 8.0有少部分支持，而真正支持比较完整的是Opera 11.</p>
<p><strong>autofocus</strong><br />
页面载入后自动将焦点转到某个input，就如以前的onload时候xxx.focus()</p>
<p><strong>required</strong><br />
指定某个input为必填，提交时会有validation，在Opera11里还会给你这样的警告并且禁止提交：<br />
<a href="http://www.flickr.com/photos/40741608@N08/5349345730/" title="Screenshot - 01122011 - 10:53:41 PM by 贝小塔, on Flickr"><img src="http://farm6.static.flickr.com/5083/5349345730_f6696fd07e.jpg" width="329" height="144" alt="Screenshot - 01122011 - 10:53:41 PM" /></a></p>
<p><strong>email / url</strong><br />
指定某个input的特殊类型，提交时也会有对应的格式检查：<br />
<a href="http://www.flickr.com/photos/40741608@N08/5348736441/" title="Screenshot - 01122011 - 10:54:41 PM by 贝小塔, on Flickr"><img src="http://farm6.static.flickr.com/5081/5348736441_78accc61ac.jpg" width="344" height="140" alt="Screenshot - 01122011 - 10:54:41 PM" /></a></p>
<p>这样的提示可能满足不了你的替用户着想的产品经理，但是你清楚他帮你省了多少事情。而且，在DiveInfoHtml5里提到，iphone甚至为这个input做了优化，在软件盘上把空格键变得很小（因为输入邮件地址用不着），并且提供了一个@键；这就是工程师的用户体验啊。</p>
<p><strong>placeholder</strong><br />
在input里显示提示文本：<br />
<a href="http://www.flickr.com/photos/40741608@N08/5349345562/" title="Screenshot - 01122011 - 10:52:18 PM by 贝小塔, on Flickr"><img src="http://farm6.static.flickr.com/5209/5349345562_d658665b92.jpg" width="441" height="63" alt="Screenshot - 01122011 - 10:52:18 PM" /></a></p>
<p>注意到后面的红色星号了吗。这本来是我设计的一个workaround，既然Firefox 3都还不支持required validation，那么我们通过CSS来显示一个必填的提示：</p>
<div class="codecolorer-container css twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">input<span style="color: #00AA00;">&#91;</span>required<span style="color: #00AA00;">=</span><span style="color: #ff0000;">&quot;required&quot;</span><span style="color: #00AA00;">&#93;</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'(*)'</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#F00</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<p>结果这个伪类最后只有在Opera里实现了预期的效果，看<a href="http://stackoverflow.com/questions/2587669/css-after-pseudo-element-on-input-field">在Stackoverflow上的讨论</a>才得知input的:after和:before伪类只有Opera支持。</p>
<p>HTML5 Form这部分是一个真正务实的标准，你可以看到几乎每一个特性都是我们日常每时每刻都需要，几乎每个网站的JS都要实现的功能。标准是沟通上下游（浏览器和应用开发人员）的契约，一个真正反应相互需求的标准才是有实际价值的。</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2011/01/html5-form-in-opera-11/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Sunng&#039;s Canvas based Heatmap API</title>
		<link>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/</link>
		<comments>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 07:10:03 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[ANN]]></category>
		<category><![CDATA[手艺]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[visualization]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sunng.info/blog/?p=464</guid>
		<description><![CDATA[Glad to announce my works this morning: A simple heatmap API based on HTML5 canvas. The programming interface is rather simple now. To create such a heatmap, you just new a heatmap object by: &#60;canvas width="300" height="215" id="canv"&#62;&#60;/canvas&#62; heatmap = &#8230; <a href="http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Glad to announce my works this morning: A simple heatmap API based on HTML5 canvas.<br />
<a href="http://www.flickr.com/photos/40741608@N08/4347604245/" title="canvas by 贝小塔, on Flickr"><img src="http://farm5.static.flickr.com/4071/4347604245_486bd3a12e_o.jpg" width="300" height="215" alt="canvas" /></a></p>
<p>The programming interface is rather simple now. To create such a heatmap, you just new a heatmap object by:</p>
<pre class="brush:html">
&lt;canvas width="300" height="215" id="canv"&gt;&lt;/canvas&gt;
</pre>
<pre class="brush:javascript">
heatmap = new HeatMap("canv");
</pre>
<p>Then read your dataset and push data into the heatmap:</p>
<pre class="brush:javascript">
heatmap.push(x, y, value);
</pre>
<p>At last, spread the data and get the canvas rendered:</p>
<pre class="brush:javascript">
heatmap.spread();
heatmap.render();
</pre>
<p>Now you got it.</p>
<p>For advanced usage, you can specify the resolution of heatmap by px:</p>
<pre class="brush:javascript">
heatmap = new HeatMap("canv", 2);
</pre>
<p>Large value will gain performance with low image quality.</p>
<p>Also, you can specify a value to define the attenuation value of each px.</p>
<pre class="brush:javascript">
heatmap.spread(5);
</pre>
<p>Finally, there is an option to use your own color schema for heatmap generation.</p>
<pre class="brush:javascript">
heatmap.render(function(value, maxValue){
    var light = value / maxValue * 100;
    return "hsl(20, 75%, "+light+"%)";
});
</pre>
<p>The parameters passed in are current pixel value and max value in whole context.</p>
<p>That&#8217;s all the toolkit. More functionality and options might be added in future. Grab it from my bitbucket page:<br />
<a href="http://bitbucket.org/sunng/daily-coding/src/tip/canvas-heatmap/">http://bitbucket.org/sunng/daily-coding/src/tip/canvas-heatmap/</a></p>
<p>There is a demo page which you can test the api by clicking canvas:<br />
<a href="http://www.flickr.com/photos/40741608@N08/4347650163/" title="canvas-raw by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2733/4347650163_ea740356e4_o.jpg" width="326" height="284" alt="canvas-raw" /></a><br />
then click heatmap button!<br />
<a href="http://www.flickr.com/photos/40741608@N08/4348397874/" title="canvas2 by 贝小塔, on Flickr"><img src="http://farm3.static.flickr.com/2796/4348397874_8ac80b0756_o.jpg" width="314" height="275" alt="canvas2" /></a></p>
<p>This is the new year gift for my readers and my dear friends !</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2010/02/sunngs-canvas-based-heatmap-api/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Open Source Charting Toolkits in JavaScript</title>
		<link>http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/</link>
		<comments>http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 13:48:23 +0000</pubDate>
		<dc:creator>sunng</dc:creator>
				<category><![CDATA[手艺]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[svg]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.classicning.com/blog/?p=284</guid>
		<description><![CDATA[项目的下一阶段，需要做一些数据展现方面的工作，处于对Adobe产品的抵触情绪，我个人还是倾向于用JavaScript来完成。今天找了几个画Chart的库，比较一下功能和编程接口的使用，为接下来的开发做一些准备。 dojox.charting (BSD License) 没什么悬念，第一个想到的就是曾经用过的dojo。之前实习时候用dojo画chart也算是积累了一些心得。dojox.charting的最主要优点是编程接口完善、全面，可以配置的项目很多，接口易于编程，易于动态地生成、操作Chart。而另一方面最主要的问题就是文档比较匮乏，不了解的人可能问了，doc.dojotoolkit.org好强大，怎么会文档匮乏呢。其实是dojo和mootools类似，都很喜欢用option object来传递可选参数，但是这些option object在文档中没有任何涉及，很多关键的属性都在其中但是却没有办法查到，算是美中一大不足。 &#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62; &#60;html xmlns="http://www.w3.org/1999/xhtml"&#62; &#60;head&#62; &#60;script src="dojo-release-1.3.2/dojo/dojo.js" djConfig="isDebug: true"&#62;&#60;/script&#62; &#60;title&#62;Dojo&#60;/title&#62; &#60;script type="text/javascript"&#62; dojo.require("dojox.charting.Chart2D"); &#60;/script&#62; &#60;/head&#62; &#60;body&#62; &#60;h1&#62;Dojox.charting&#60;/h1&#62; &#60;div id="charting" style="width:400px; height:250px;"&#62; &#60;/div&#62; &#60;script type="text/javascript"&#62; （function charting(){ dojo.empty("charting"); &#8230; <a href="http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>项目的下一阶段，需要做一些数据展现方面的工作，处于对Adobe产品的抵触情绪，我个人还是倾向于用JavaScript来完成。今天找了几个画Chart的库，比较一下功能和编程接口的使用，为接下来的开发做一些准备。</p>
<h3>dojox.charting</h3>
<p>(BSD License)<br />
没什么悬念，第一个想到的就是曾经用过的<a href="http://dojotoolkit.org/" target="_blank">dojo</a>。之前实习时候用dojo画chart也算是积累了一些心得。dojox.charting的最主要优点是编程接口完善、全面，可以配置的项目很多，接口易于编程，易于动态地生成、操作Chart。而另一方面最主要的问题就是文档比较匮乏，不了解的人可能问了，doc.dojotoolkit.org好强大，怎么会文档匮乏呢。其实是dojo和<a href="http://mootools.net">mootools</a>类似，都很喜欢用option object来传递可选参数，但是这些option object在文档中没有任何涉及，很多关键的属性都在其中但是却没有办法查到，算是美中一大不足。</p>
<pre class="brush:html">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;

	&lt;script src="dojo-release-1.3.2/dojo/dojo.js" djConfig="isDebug: true"&gt;&lt;/script&gt;

	&lt;title&gt;Dojo&lt;/title&gt;

	&lt;script type="text/javascript"&gt;

		dojo.require("dojox.charting.Chart2D");

	&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

	&lt;h1&gt;Dojox.charting&lt;/h1&gt;

	&lt;div id="charting" style="width:400px; height:250px;"&gt;

	&lt;/div&gt;

	&lt;script type="text/javascript"&gt;

		（function charting(){

			dojo.empty("charting");

			var data = [2,4,5,7,7,4,4,7];

			var chart = new dojox.charting.Chart2D("charting");

			chart.addPlot("default", {type: "Lines", markers: true, shadows: {dw:2, dy:2, dx:2}});

			chart.addPlot("additional", {type: "Areas"});

			chart.addPlot("other", {type: "ClusteredColumns"})

			chart.addAxis("x");

			chart.addAxis("y", {vertical: true, min:0, max: 10});

			chart.addSeries("Testing Data 1", data);

			chart.addSeries("Average", dojo.map(data, function(it){return (Math.sin(it)+Math.random())*4}), {

				fill: "rgba(145, 213, 100, 0.5)", plot:"additional"

			});

			chart.addSeries("All Random", dojo.map(data, function(it){return (Math.random()*5)}), {

				plot: "other", fill: "#AEC6E2", stroke:{color:"#333", width:1}

			});

			chart.render();

		}）();

	&lt;/script&gt;

&lt;/body&gt;

&lt;/html&gt;</pre>
<h3>Protovis</h3>
<p>(BSD License)<br />
<a href="http://vis.stanford.edu/protovis/" target="_blank">Protovis</a>，看域名就知道是斯坦福的项目，Protovis是在prototype基础上，不仅有charting的功能，还包括其他可视化方法的实现。看了Demo会发现它真的很不错，不过Protovis的本意似乎只是借助浏览器的图形功能实现可视化，它并没有提供超出可视化范畴的其他东西，甚至看过实例的代码你会发现，作者是不折不扣的函数式编程和链式方法的爱好者，Protovis的代码算是出神入化了，如果你想看看学术的JavaScript是如何写的，那就看看这个发表了论文的JavaScript库吧。<br />
看起来是很出神入化，可是这样的编程接口如果要用在动态的数据展现上，实在是难以想象。况且，pv.Panel居然没有传入dom对象的接口，无从控制chart的生成位置。说白了，Protovis并不是一个满足项目需要的Library，不过它的功能和代码还是值得多看几眼的。</p>
<pre class="brush:html">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;

	&lt;script src="protovis-3.1/protovis-r3.1.js"&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

	&lt;div id="page"&gt;

		&lt;h1&gt;Protovis&lt;/h1&gt;

		&lt;div style="border:1px #CCC solid;"&gt;

			&lt;script type="text/javascript"&gt;

				var width = 300;

				var height = 225;

				var data = [1,2,3,4,6,7,5,8,9];

				var dataMax = data[0];

				for(var i=1; i&lt;data.length; i++){

					dataMax = dataMax &gt; data[i] ? dataMax : data[i];

				}

				var x = pv.Scale.linear(0, dataMax).range(0, width);

				var y = pv.Scale.ordinal(pv.range(10)).splitBanded(0, height, 0.9);

				var charting = new pv.Panel();

				charting.width(width).height(height).left(20).top(20);

				var bar = charting.add(pv.Bar);

				bar.data(data).top(function() y(this.index)).height(y.range().band).left(0).width(x);

				bar.anchor("center").add(pv.Label)

					.textStyle("white")

					.textAlign("center")

					.text(function(d) d.toFixed(1));

				charting.add(pv.Rule)

					.data(x.ticks())

					.left(function(d) Math.round(x(d)) - .5)

					.strokeStyle(function(d) d ? "rgba(255,255,255,.3)" : "#000")

				.add(pv.Rule)

					.bottom(0)

					.height(5)

					.strokeStyle("#C00")

					.anchor("bottom").add(pv.Label)

					.text(function(d) d);

				charting.render();

			&lt;/script&gt;

		&lt;/div&gt;

	&lt;/div&gt;

&lt;/body&gt;

&lt;/html&gt;</pre>
<h3>Flotr</h3>
<p>(MIT License)<br />
不同于上面两个库通过SVG绘图，<a href="http://solutoire.com/category/flotr/" target="_blank">Flotr</a>是用canvas api来完成绘制的。与dojo相比，Flotr的API比较简单，主要只有一个Flotr.draw方法，可以传入三个参数：目标DOM对象，数据和绘图选项。和dojo不同，Flotr的文档里关于这个option object有非常明确的文档。另外强大的是Flotr还提供了一些交互的功能，支持事件绑定。</p>
<pre class="brush:html">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

&lt;head&gt;

	&lt;script src="flotr-0.2.0-alpha/flotr/lib/prototype-1.6.0.2.js"&gt;&lt;/script&gt;

	&lt;script src="flotr-0.2.0-alpha/flotr/flotr-0.2.0-alpha.js"&gt;&lt;/script&gt;

	&lt;title&gt;Flotr&lt;/title&gt;

	&lt;script type="text/javascript"&gt;

	&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

	&lt;h1&gt;Flotr&lt;/h1&gt;

	&lt;div id="charting" style="width:400px; height:250px;"&gt;

	&lt;/div&gt;

	&lt;script type="text/javascript"&gt;

		(function d(){

			var series1 = {data: (function(){

				var d = [];

				for(var i=0; i&lt;10; i+=0.5){

					d.push([i, Math.random()-0.5+Math.sin(i)*3]);

				}

				return d;

			})(), label:"d1", lines:{fill:true}};

			var series2 = {data: (function(){

				var d = [];

				for(var i=0; i&lt;10; i+=0.5){

					d.push([i, (Math.random()-0.5)*2+Math.cos(i)*2]);

				}

				return d;

			})(), label: "s2", points:{show:true}, lines:{show:true}};

			Flotr.draw($("charting"), [series1, series2], {

				legend: {position :"se"},

				yaxis: {min: -3.5, max:3.5}

			});

		})();

	&lt;/script&gt;

&lt;/body&gt;

&lt;/html&gt;</pre>
<p>此外，还有一个与Flotr很类似的<a href="http://www.deensoft.com/lab/protochart/">Protochart</a>，后者的网站上写自己是motivated by Flotr，不过我很难想象功能几乎相同是如何motivated的。</p>
<h3>MilkChart</h3>
<p>(Apache License 2.0)<br />
<a href="http://code.google.com/p/milkchart/">MilkChart</a>是一个建立在Mootools上的Charting库，采用canvas api绘图。它的特点是把HTML Table的数据绘制成Chart，如果场景允许，倒是省去了不少构建数组的麻烦。这个项目目前规模还不大，并且在作者积极的开发中，可以参考它的Wiki获得详细的使用方法。</p>
]]></content:encoded>
			<wfw:commentRss>http://sunng.info/blog/2009/10/open-source-charting-libraries-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

