include/lib/jqplot/docs/files/optionsTutorial-txt.html
(开头部分) 19KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><title>Options Tutorial</title><link rel="stylesheet" type="text/css" href="../styles/main.css"><script language=JavaScript src="../javascript/main.js"></script><script language=JavaScript src="../javascript/searchdata.js"></script></head><body class="ContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version 1.4 -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<div id=Content><div class="CSection"><div class=CTopic id=MainTopic><div class="CTitle logo"><div class="nav"><a class="nav" href="../../index.php"><span>></span>Home</a><a class="nav" href="../../tests/"><span>></span>Examples</a><a class="nav" href="../../docs/"><span>></span>Docs</a><a class="nav" href="http://bitbucket.org/cleonello/jqplot/downloads/"><span>></span>Download</a><a class="nav" href="../../info.php"><span>></span>Info</a><a class="nav" href="../../donate.php"><span>></span>Donate</a></div><a name="Options_Tutorial"></a>Options Tutorial</div><div class=CBody><p>This document will help you understand how jqPlot’s options relate to the API documentation and the jqPlot object itself. For a listing of options available to jqPlot, see <a href="jqPlotOptions-txt.html#jqPlot_Options" class=LSection id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">jqPlot Options</a> in the jqPlotOptions.txt file.</p><p>The key to effectively using jqPlot is understanding jqPlot’s options. The online documentation is API documentation. While it explains what attributes and methods various objects posses, it doesn’t explain how to use or set those attributes through options. This tutorial will help explain that.</p><p>Lets assume you are creating a plot like this:</p><blockquote><pre>chart = $.jqplot('chart', dataSeries, optionsObj);</pre></blockquote><p>First, note that you shouldn’t try to directly set attributes on the “chart” object (like chart.grid.shadow) after your call to $.jqplot(). At best this won’t do anything **(see below). You should pass options in via the “optionsObj”.</p><p>the optionsObj really represents the plot object (jqPlot object, not to be confused with the $.jqplot function which will create a jqPlot object). Attributes you specify on that object will be merged with attributes in the jqPlot object. The axes, legend, series, etc. are attributes on the jqPlot object. The jqPlot/optionsObj object looks something like (only some attributes shown):</p><blockquote><pre>jqPlot-|
|-seriesColors
|-textColor
|-fontFamily
|-fontSize
|-stackSeries
|-series(Array)-|
| |-Series1-|
| | |-lineWidth
| | |-linePattern
| | |-shadow
| | |-showLine
| | |-showMarker
| | |-color
| |-Series2...
| |-...
| |-SeriesN
|
|-grid(Object)-|
| |-drawGridLines
| |-background
| |-borderColor
| |-borderWidth
| |-shadow
|
|-title(Object)-|
| |-text
| |-show
| |-fontFamily
| |-fontSize
| |-textAlign
| |-textColor
|
|-axes(Object)-|
| |-xais-|
| | |-min
| | |-max
| | |-numberTicks
| | |-showTicks
| | |-showTickMarks
| | |-pad
|
| ... and so on</pre></blockquote><p>The optionsObj should follow the same construction as if it were a jqPlot object (with some exceptions/shortcuts I’ll mention in a moment). So generally, when you see something like “this.drawGridLines” in the grid properties in the docs, just replace “this” with “grid” in your options object. So it becomes optionsObj.grid.drawGridLines. Do likewise with the other objects in the plot, replacing “this”, with the respective attribute on the plot like “legend” or “title”. Series and Axes are handled a little different, because series is an array and axes has 4 distinct children “xaxis”, “yaxis”, “x2axis” and “y2axis”.</p><p>So, to remove the shadow from the grid and change the grid border size you would do:</p><blockquote><pre>optionObj = {grid:{shadow:false, borderWidth:9.0}};</pre></blockquote><p>To do the same as above but also make all the text in the plot red you would do:</p><blockquote><pre>optionObj = {
textColor:"#ff0000",
grid:{shadow:false, borderWidth:9.0}
}</pre></blockquote><p>Here is a more deeply nested example. Say you want to specify a min and max on your y axis and use a specific color for your second series. That would look like:</p><blockquote><pre>optionsObj = {
axes:{yaxis:{min:5, max:230}},
后面还有 60 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
