|
VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
|
上一篇主題 :: 下一篇主題 |
發表人 |
內容 |
ericchuang
註冊時間: 2007-11-15 文章: 10
第 1 樓
|
發表於: 星期五 四月 25, 2008 12:06 pm 文章主題: [分享]簡易統計圖製作(simplechart.vcx) |
|
|
最近在研究統計圖表的製作,一直在本站潛水搜尋適合的文件解決我目前的難題; 終於我在 http://www.ml-consult.co.uk/foxst-23.htm 這個網站找到了我要的一個解決方案; 現在, 我也野人獻曝一下, 這個vcx我個人覺得還滿不錯的! 分享給有需要的同好們! 若有版上先進已用過,是否也可以分享一下心得!
以下是此類別的說明文件(在類別內也有):
* Documentation for the class. Not intended to be executed.
* SimpleChart class. Written by Mike Lewis (Mike Lewis Consultants
* Ltd.), February - March 2002.
* Copyright Mike Lewis Consultants Ltd. All rights reserved.
* Feel free to use this class in any way you like, but please
* do not remove our copyright notice or the following disclaimer:
* Although we have tested this class thoroughly, we cannot accept
* any legal liability for its use. Do not use this class unless you
* are satisfied that it works correctly in your application.
* We welcome your feedback. Please email Mike Lewis at mikl@compuserve.com
* or see www.ml-consult.co.uk
* What does it do?
* The SimpleChart class produces two- and three-dimensional charts
* and graphs, using data from a Visual FoxPro table or cursor.
* What do I need?
* The class is based on Microsoft's MSChart ActiveX control
* (MSChrt20.Ocx), which comes with VFP 6.0 and 7.0. To use the
* class, you will need the ActiveX control to be installed on your
* own computer. To distribute applications which use the class,
* you will need to ensure that the OCX file is present and
* properly registered on the end-user's computer.
* How do I use it?
* The first step is to provide a table or cursor which contains
* the data required for your chart. Then drop the class on a VFP
* form, set certain properties, and finally call its CreateChart
* method.
* The cursor
* The chart is always populated with data from a cursor (or
* table). You can use an existing cursor if it already contains
* the required data, or you can create one specifically for this
* purpose.
* The cursor must have the following characteristics:
* - A record for each data point on the chart.
* - A field for each of the series on the chart. These fields must
* be numeric.
* - Optionally, a field containing the row label for the current
* record. This field must be a character string.
* As an example, suppose you wanted to plot monthly sales value
* and monthly sales quantity for the year to date. Your cursor might look
* something like this:
* MONTH_NAME SALES_VAL SALES_QTY
* JAN 4000 32
* FEB 4020 33
* MAR 4090 36
* APR 4070 34
* This will produce a chart with two lines and four
* data points. The horizotal axis will show the four month names
* as labels.
* Minimum properties
* Once you have dropped the SimpleChart control onto a VFP form,
* you must set certain properties. You can do this either in the
* Form Designer or in code (for example, in the control's Init
* event).
* The following are the key properties that you must set:
* cAlias The alias of the cursor (or table) containing the
* data to be plotted.
*
* cData A comma-delimited list of the fields within the
* cusor which contain the actual data.
* In addition, you will probably want to set one or both of the
* following properties:
* cRowLabels The name of the field within the cursor
* containing the row labels (these will appear
* along the x-axis).
* cLabels A comma-delimited list of the labels that are to
* appear in the legend (if any).
* To continue with the above example, the following code sets the
* required properties:
* WITH THIS
* .cAlias = "csrSales"
* .cData = "sales_val,sales_qty"
* .cRowLabels = "month_name"
* .cLabels = "Value,Quantity"
* ENDWITH
* Other properties
* The above properties are the only ones needed to create a
* default chart. However, the class also exposes many other
* properties that can be used to customise the chart in various
* ways. Some of the more important of these are listed below.
* The folowing are native properties of the MSChart control
* (further details can be found in the Help file for the control).
* BorderStyle The border for the entire chart (0 = no
* border, 1 = single line; default 0).
* ChartType 0=3D bar, 1=2D bar, 2=3D line, 3=2D line,
* 4=3D area, 5=2D area, 6=3D step, 7=2D step,
* and several others (default 3).
* ShowLegend .T. to show a legend (default .F.).
* And these are custom properties that you might wish to use:
* cColours A comma-delimited list of the colours to be use
* for the chart. The following colours are supported:
* red, green, blue, black, white, grey, gray, yellow,
* brown, magenta, cyan, darkblue, darkgreen
* For example, if the chart has three series, the following
* code will set these to blue, white and yellow
* respectively:
* THIS.cColours = "BLUE,WHITE,YELLOW"
* (these are not case-sensitive)
* cFootnote Text of a small title which appears at the bottom
* of the chart
* cTitle Text of a main title for the chart; this appears
* centred at the top of the chart
* lIgnoreZero If .T., any zero values in the data will not
* be plotted. (Default .F.).
* lShowMarkers If T., data points will be highlighted by special symbols.
* (Default .F.)
* Creating the chart
* Once you have set the required properties, call the control's
* CreateChart method. This will read the cursor, populate the
* chart with data, and display the chart. The cursor must be open
* when you call this method.
* Things that can go wrong
* If the CreateChart method is unable to create the chart, it
* will return .F. and the chart will not appear. If this happens,
* you should check the following:
* - The cursor or table containing the data must be open, and
* its alias stored in the cAlias property.
* - The cData property must contain the name of at least one of
* the (numeric) fields from the cursor.
* |
|
回頂端 |
|
|
janlih
註冊時間: 2003-11-04 文章: 69
第 2 樓
|
發表於: 星期三 四月 30, 2008 10:28 am 文章主題: |
|
|
請問樓上大大,table已開,也有數值欄位,可是run後無法顯示,system32資料夾也有mschrt20.ocx
use gcdatapath+"simplechart1.dbf" alias chart1 in 0
select chart1
with thisform.simplechart1
.calias = "chart1"
.cdata = "sales_val,sales_qty"
.crowlabels = "month_name"
.clabels = "value,Quantity"
endwith
已解決
最後要加入 .createchart() |
|
回頂端 |
|
|
garfield Site Admin
註冊時間: 2003-01-30 文章: 2158
第 3 樓
|
|
回頂端 |
|
|
ericchuang
註冊時間: 2007-11-15 文章: 10
第 4 樓
|
發表於: 星期五 五月 02, 2008 1:59 pm 文章主題: |
|
|
吼! 這個厲害, 對我而言, 這個應該已經算是大師級的應用了! 感謝 garfield大的分享! |
|
回頂端 |
|
|
ezpos
註冊時間: 2011-04-20 文章: 323
第 5 樓
|
|
回頂端 |
|
|
tuberose
註冊時間: 2006-05-02 文章: 33
第 6 樓
|
發表於: 星期三 六月 24, 2015 2:17 pm 文章主題: |
|
|
主页找:http://vfpx.codeplex.com/
或者在:http://vfpx.codeplex.com/releases/view/106904 |
|
回頂端 |
|
|
ckp6250
註冊時間: 2004-07-30 文章: 1645
第 7 樓
|
發表於: 星期三 六月 24, 2015 8:50 pm 文章主題: |
|
|
這個也是好貨
google chart api
簡單易用跨平台
若是新學製圖的話,最好不要花心思在vfp |
|
回頂端 |
|
|
ezpos
註冊時間: 2011-04-20 文章: 323
第 8 樓
|
|
回頂端 |
|
|
Abel
註冊時間: 2005-03-14 文章: 189 來自: 鹿港小鎮
第 9 樓
|
發表於: 星期五 三月 15, 2019 3:09 pm 文章主題: |
|
|
回覆 ezpos 大
整支程式開發完成後,移機至 User 電腦中有兩個注意要件
1. system.app 需隨程式分發,路徑置於 config.fpw檔 內的 DEFAULT 指定中 (預設路徑)
2. vfp9 RunTime檔 (程式所在執行路徑中) 一定要是 sp2 版本以上(含),如果是低版本會有兩種情形
a. 出現錯誤「 無效的 SYSTEM 成員 」
b. 程式雖然能執行,但是 主Form 中的「圖表」不會出現
以上是個人心得 |
|
回頂端 |
|
|
|
|
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
|
|