4

プレゼンテーション目的のためだけに(そしてタスク期間バーを表示するためだけに-それらの間に接続線はありません)、かなりシンプルな(そして安価な)ソリューションが必要です。したがって、たとえばこのような高度なカスタム コントロールを購入することには興味がありません。このようなものを使用したことがありますか?コードサンプルはありますか?

4

2 に答える 2

4

ネイティブ データウィンドウでガントを実行する方法の例については、Buck Woolley の dwExtreme サイトを参照してください。しかし、自分で巻きたいのであれば、「単純」はあなたの将来にはないと思います。実際、誰かが完全な説明を含む投稿を書いたら、私はうれしい驚きを覚えるでしょう。何ページもかかると思います。(誰かが私が間違っていることを証明してくれたら幸いです。) それまでの間、必要と思われるデータウィンドウの基本をいくつか示します。

  • データ ソースがテーブルに関連付けられていない外部データウィンドウを作成できます
  • データ セット内の列をユーザー インターフェイスに表示する必要はありません
  • データ セット内の列を式で使用して属性を評価できるため、四角形の次の属性ごとに列を作成できます。
    • バツ

これには多くの作業と時間が必要であり、このコンポーネントを購入する価値は十分にあると思います (一部の IT ショップでは、あなたの時間がほとんど価値がない場合を除きます)。

幸運を、

テリー

于 2010-03-05T13:51:08.563 に答える
2

PowerBuilder のガント チャート
(ソース: illudium.com )

積み上げ棒グラフ (ペインタの BarStacked (5)) を使用して、単純なガント チャートを作成できます。トリックは、ダミーの系列を作成してバーを必要な場所に配置し、ダミーのバーをグラフの背景 (BackColor) と同じ色にすることです。軸上に配置するには、値が小さい別のダミー シリーズも必要であることがわかります。そうしないと、間隔を設定しているバーの色を変更すると、軸線が途切れてしまいます。この値には .04 が適していることがわかりました。

データウィンドウを作成する

(これは、データウィンドウ ウィザードに精通していることを前提としています。データウィンドウでのグラフ作成の詳細については、『PowerBuilder ユーザーズ ガイド』を参照してください)

新しいオブジェクト ウィザードのアイコンをクリックします。外部データ ソースを使用してグラフ データウィンドウを作成します。列 task type string(20)、ser type string(1)、および days type number を作成します。カテゴリをタスク列に、値を日数列に設定します。[シリーズ] ボタンをクリックし、シリーズの [ser] を選択します。タイトルは気にせず、積み上げ棒グラフ タイプを選択します。ペインタが開いたら、データウィンドウを保存します。Painter の General タブで、Legend を None (0) に変更します。[軸] タブで [カテゴリ] 軸を選択し、並べ替えを [並べ替えなし] (0) に設定します。[値] 軸を選択し、並べ替えを [並べ替えなし] (0) に設定します。Series 軸を選択し、並べ替えを昇順 (1) に設定します。データウィンドウを保存します。

ウィンドウを作成する

ウィンドウを作成し、データウィンドウ コントロール dw_1 を配置します。データ オブジェクトをグラフ データウィンドウに設定します。以下を open イベント (または PFC を使用している場合は pfc_postopen) に配置します。

try

    dw_1.setRedraw(FALSE)

    // LOAD DATA HERE

    dw_1.object.gr_1.title = 'Project PBL Pusher'
    dw_1.object.gr_1.category.label = 'Phase'
    dw_1.object.gr_1.values.label = 'Project-Days'


catch (runtimeerror re)
    if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text)    // could do better
finally
    dw_1.setRedraw(TRUE)
end try

コメントが示す場所にチャートのデータをロードします// LOAD DATA HERE

グラフ作成イベントのスクリプト

新しいイベントを dw_1 に追加します。イベント ID に pbm_dwngraphcreate を選択します。pbm_dwn プレフィックスを削除してこれらのイベントに名前を付けるのが好きなので、graphcreate を使用します。次のコードをイベントに追加します。

string ls_series
long li_color

try


    li_color=long(dw_1.object.gr_1.backcolor)

    // note first series is a dummy with a small value (0.04 seems to work) to keep the line from being hidden
    ls_series = dw_1.seriesName("gr_1", 2)
    if 0 = len(ls_series) then return       // maybe show error message

    // will return -1 when you set color same as the graph's backcolor but it sets the color
    dw_1.setSeriesStyle("gr_1", ls_series, BackGround!, li_color)   // the box
    dw_1.setSeriesStyle("gr_1", ls_series, ForeGround!, li_color)   // the inside

catch (runtimeerror re)
    if isvalid(gnv_app.inv_debug) then gnv_app.inv_debug.of_message(re.text)    // could do better
end try

グラフのデータ

必要な順序とは逆の順序でカテゴリを使用してデータを読み込みます。タスクごとに 3 行を挿入し、系列をそれぞれ a、b、および c に設定します。各タスクのシリーズ a には、小さい値を設定します。0.04を使用しました。実験する必要があるかもしれません。各タスクのシリーズ b には、開始までの日数を設定します。系列 c の場合、日数を設定します。以下は、サンプル データウィンドウのデータです。

    Task    Ser Days
    ----    --- ----
    Test    a   0.04
    Test    b   24
    Test    c   10
    Develop a   0.04
    Develop b   10
    Develop c   14
    Design  a   0.04
    Design  b   0
    Design  c   10

サンプル データウィンドウ

以下は、エクスポート形式のサンプル データウィンドウのソースです。PB 10 以上の任意のバージョンにインポートできるはずです。コードをコピーして、SRD 拡張子を持つファイルに貼り付けてから、インポートします。

HA$PBExportHeader$d_graph.srd
release 10;
datawindow(units=0 timer_interval=0 color=1073741824 processing=3 HTMLDW=no print.printername="" print.documentname="" print.orientation = 1 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=0 color="536870912" )
table(column=(type=char(10) updatewhereclause=yes name=task dbname="task" )
 column=(type=char(1) updatewhereclause=yes name=ser dbname="ser" )
 column=(type=number updatewhereclause=yes name=days dbname="days" )
 )
data("Test","a", 0.04,"Test","b", 24,"Test","c", 10,"Develop","a", 0.04,"Develop","b", 10,"Develop","c", 14,"Design","a", 0.04,"Design","b", 0,"Design","c", 10,) 
graph(band=background height="1232" width="2798" graphtype="5" perspective="2" rotation="-20" color="0" backcolor="16777215" shadecolor="8355711" range= 0 border="3" overlappercent="0" spacing="100" plotnulldata="0" elevation="20" depth="100"x="0" y="0" height="1232" width="2798"  name=gr_1 visible="1"  sizetodisplay=1  series="ser"  category="task"  values="days"  title="Title"  title.dispattr.backcolor="553648127"  title.dispattr.alignment="2"  title.dispattr.autosize="1"  title.dispattr.font.charset="0"  title.dispattr.font.escapement="0"  title.dispattr.font.face="Tahoma"  title.dispattr.font.family="2"  title.dispattr.font.height="0"  title.dispattr.font.italic="0"  title.dispattr.font.orientation="0"  title.dispattr.font.pitch="2"  title.dispattr.font.strikethrough="0"  title.dispattr.font.underline="0"  title.dispattr.font.weight="700"  title.dispattr.format="[general]"  title.dispattr.textcolor="0"  title.dispattr.displayexpression="title"  legend="0"  legend.dispattr.backcolor="536870912"  legend.dispattr.alignment="0"  legend.dispattr.autosize="1"  legend.dispattr.font.charset="0"  legend.dispattr.font.escapement="0"  legend.dispattr.font.face="Tahoma"  legend.dispattr.font.family="2"  legend.dispattr.font.height="0"  legend.dispattr.font.italic="0"  legend.dispattr.font.orientation="0"  legend.dispattr.font.pitch="2"  legend.dispattr.font.strikethrough="0"  legend.dispattr.font.underline="0"  legend.dispattr.font.weight="400"  legend.dispattr.format="[general]"  legend.dispattr.textcolor="553648127"  legend.dispattr.displayexpression="' '" 
    series.autoscale="1" 
    series.displayeverynlabels="0"  series.droplines="0"  series.frame="1"  series.label="(None)"  series.majordivisions="0"  series.majorgridline="0"  series.majortic="3"  series.maximumvalue="0"  series.minimumvalue="0"  series.minordivisions="0"  series.minorgridline="0"  series.minortic="1"  series.originline="1"  series.primaryline="1"  series.roundto="0"  series.roundtounit="0"  series.scaletype="1"  series.scalevalue="1"  series.secondaryline="0"  series.shadebackedge="0"  series.dispattr.backcolor="536870912"  series.dispattr.alignment="0"  series.dispattr.autosize="1"  series.dispattr.font.charset="0"  series.dispattr.font.escapement="0"  series.dispattr.font.face="Tahoma"  series.dispattr.font.family="2"  series.dispattr.font.height="0"  series.dispattr.font.italic="0"  series.dispattr.font.orientation="0"  series.dispattr.font.pitch="2"  series.dispattr.font.strikethrough="0"  series.dispattr.font.underline="0"  series.dispattr.font.weight="400"  series.dispattr.format="[general]"  series.dispattr.textcolor="0"  series.dispattr.displayexpression="series"  series.labeldispattr.backcolor="553648127"  series.labeldispattr.alignment="2"  series.labeldispattr.autosize="1"  series.labeldispattr.font.charset="0"  series.labeldispattr.font.escapement="0"  series.labeldispattr.font.face="Tahoma"  series.labeldispattr.font.family="2"  series.labeldispattr.font.height="0"  series.labeldispattr.font.italic="0"  series.labeldispattr.font.orientation="0"  series.labeldispattr.font.pitch="2"  series.labeldispattr.font.strikethrough="0"  series.labeldispattr.font.underline="0"  series.labeldispattr.font.weight="400"  series.labeldispattr.format="[general]"  series.labeldispattr.textcolor="0"  series.labeldispattr.displayexpression=" seriesaxislabel"  series.sort="1" 
    category.autoscale="1" 
    category.displayeverynlabels="0"  category.droplines="0"  category.frame="1"  category.label="(None)"  category.majordivisions="0"  category.majorgridline="0"  category.majortic="3"  category.maximumvalue="0"  category.minimumvalue="0"  category.minordivisions="0"  category.minorgridline="0"  category.minortic="1"  category.originline="0"  category.primaryline="1"  category.roundto="0"  category.roundtounit="0"  category.scaletype="1"  category.scalevalue="1"  category.secondaryline="0"  category.shadebackedge="1"  category.dispattr.backcolor="556870912"  category.dispattr.alignment="1"  category.dispattr.autosize="1"  category.dispattr.font.charset="0"  category.dispattr.font.escapement="0"  category.dispattr.font.face="Tahoma"  category.dispattr.font.family="2"  category.dispattr.font.height="0"  category.dispattr.font.italic="0"  category.dispattr.font.orientation="0"  category.dispattr.font.pitch="2"  category.dispattr.font.strikethrough="0"  category.dispattr.font.underline="0"  category.dispattr.font.weight="400"  category.dispattr.format="[general]"  category.dispattr.textcolor="0"  category.dispattr.displayexpression="category"  category.labeldispattr.backcolor="556870912"  category.labeldispattr.alignment="2"  category.labeldispattr.autosize="1"  category.labeldispattr.font.charset="0"  category.labeldispattr.font.escapement="900"  category.labeldispattr.font.face="Tahoma"  category.labeldispattr.font.family="2"  category.labeldispattr.font.height="0"  category.labeldispattr.font.italic="0"  category.labeldispattr.font.orientation="900"  category.labeldispattr.font.pitch="2"  category.labeldispattr.font.strikethrough="0"  category.labeldispattr.font.underline="0"  category.labeldispattr.font.weight="400"  category.labeldispattr.format="[general]"  category.labeldispattr.textcolor="0"  category.labeldispattr.displayexpression="categoryaxislabel"  category.sort="0" 
    values.autoscale="1" 
    values.displayeverynlabels="0"  values.droplines="0"  values.frame="1"  values.label="(None)"  values.majordivisions="0"  values.majorgridline="0"  values.majortic="3"  values.maximumvalue="1500"  values.minimumvalue="0"  values.minordivisions="0"  values.minorgridline="0"  values.minortic="1"  values.originline="1"  values.primaryline="1"  values.roundto="0"  values.roundtounit="0"  values.scaletype="1"  values.scalevalue="1"  values.secondaryline="0"  values.shadebackedge="0"  values.dispattr.backcolor="556870912"  values.dispattr.alignment="2"  values.dispattr.autosize="1"  values.dispattr.font.charset="0"  values.dispattr.font.escapement="0"  values.dispattr.font.face="Tahoma"  values.dispattr.font.family="2"  values.dispattr.font.height="0"  values.dispattr.font.italic="0"  values.dispattr.font.orientation="0"  values.dispattr.font.pitch="2"  values.dispattr.font.strikethrough="0"  values.dispattr.font.underline="0"  values.dispattr.font.weight="400"  values.dispattr.format="[General]"  values.dispattr.textcolor="0"  values.dispattr.displayexpression="value"  values.labeldispattr.backcolor="553648127"  values.labeldispattr.alignment="2"  values.labeldispattr.autosize="1"  values.labeldispattr.font.charset="0"  values.labeldispattr.font.escapement="0"  values.labeldispattr.font.face="Tahoma"  values.labeldispattr.font.family="2"  values.labeldispattr.font.height="0"  values.labeldispattr.font.italic="0"  values.labeldispattr.font.orientation="0"  values.labeldispattr.font.pitch="2"  values.labeldispattr.font.strikethrough="0"  values.labeldispattr.font.underline="0"  values.labeldispattr.font.weight="700"  values.labeldispattr.format="[general]"  values.labeldispattr.textcolor="0"  values.labeldispattr.displayexpression="valuesaxislabel" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )
xhtmlgen() cssgen(sessionspecific="0" )
xmlgen(inline="0" )
xsltgen()
jsgen()
export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )
import.xml()
export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )
export.xhtml()
于 2010-03-09T21:08:41.337 に答える