棒を使用してデータ系列をプロットする
説明
注意事項
例
例 | |
{import * from CURL.GUI.CHARTS} {import * from CHARTS-DOC, location = "../docstring-support/gui/charts-doc.scurl" } {define-proc package {h-gradient start-color:FillPattern, highlight-color:FillPattern, end-color:FillPattern, highlight-pos:double = 0.2 }:FillPattern {return {LinearGradientFillPattern {Fraction2d 0, 0}, {Fraction2d 1, 0}, {Spectrum.from-envelope start-color, 0.0, highlight-color, highlight-pos, end-color, 1.0 } } } } {let chart:LayeredChart = {LayeredChart width = 15cm, height = 6cm, color-palette = {new {Array-of FillPattern}, {h-gradient "gray", "white", "gray"}, {h-gradient "blue", "lavender", "steelblue"}, {h-gradient "red", "mistyrose", "crimson"}, {h-gradient "purple", "lavender", "blueviolet"}, {h-gradient "lime", "mintcream", "green"} }, bar-border-width = 2px, bottom-axis = {EnumeratedBarChartAxis {ChartDataSeries sample-records, "Name"} }, {BarLayer sample-records, "Age", "Points", shape-factory = {proc {layer:BarLayer, rectangle:GRect, record:Record, record-index:int, series-index:int, border-width:any, border-line-style:LineStyle }:Shape let constant stock-shape:Shape = {BarLayer.default-shape-factory layer, rectangle, record, record-index, series-index, border-width, border-line-style } {stock-shape.add-event-handler {on PointerEnter at s:Shape do set s.border-color = FillPattern.yellow } } {stock-shape.add-event-handler {on PointerLeave at s:Shape do {unset s.border-color} } } {return stock-shape} } } } } {Canvas width = chart.width, height = chart.height, chart } {RadioFrame {HBox spacing = 4pt, {RadioButton radio-value = ChartStackingMode.none, value = true}, {RadioButton radio-value = ChartStackingMode.stacked}, {RadioButton radio-value = ChartStackingMode.percent} }, {on ValueFinished at rf:RadioFrame do let constant layer:BarLayer = chart.layers[0] asa BarLayer set layer.stacking-mode = rf.value asa ChartStackingMode } } |
新規の BarLayer を作成します。 |
この BarLayer 内の棒の境界の |
この BarLayer 内の棒の境界幅。 |
棒クラスタの間隔。 |
この BarLayer のプロットを表す |
この BarLayer 内の各プロット |
スタイリングの目的のための、この |
BarLayer |
この ChartLayer の |
必要な場合には、この ChartLayer を表すのに適切な X 軸を作成します。 |
この ChartLayer の内部レイアウトを更新します。 |
新規の BarLayer を作成します。
例
この BarLayer のプロットを表す
説明
この BarLayer 内の各プロット
説明
例
例: 次の使用: BarLayer.shape-factory | |
{import * from CURL.GUI.CHARTS} {import * from CHARTS-DOC, location = "../docstring-support/gui/charts-doc.scurl" } {let chart:LayeredChart = {LayeredChart width = 15cm, height = 6cm, bar-border-width = 2px, {BarLayer sample-records, "Age", "Points", shape-factory = {proc {layer:BarLayer, rectangle:GRect, record:Record, record-index:int, series-index:int, border-width:any, border-line-style:LineStyle }:Shape {return {EllipseShape rectangle, border-width = border-width, border-line-style = border-line-style, color = {layer.get-fill-pattern-for-data-series series-index } } } } } } } {Canvas width = chart.width, height = chart.height, chart } {RadioFrame {HBox spacing = 4pt, {RadioButton radio-value = ChartStackingMode.none, value = true}, {RadioButton radio-value = ChartStackingMode.stacked}, {RadioButton radio-value = ChartStackingMode.percent} }, {on ValueFinished at rf:RadioFrame do let constant layer:BarLayer = chart.layers[0] asa BarLayer set layer.stacking-mode = rf.value asa ChartStackingMode } } |
スタイリングの目的のための、この
説明
オーバーライド
BarLayer
戻り値
説明
戻り値
説明
この ChartLayer の
戻り値
説明
注意事項
例
例: ChartDataMapping を使用しての Shape のグラフへの追加 | |
{import * from CURL.GUI.CHARTS} {import * from CHARTS-DOC, location = "../docstring-support/gui/charts-doc.scurl" } {let chart:LayeredChart = {LayeredChart width = 15cm, height = 6cm, {BarLayer sample-records, "Age", x-axis-data = {ChartDataSeries sample-records, "Name"} }, {LineLayer sample-records, "Wins" }, {on ChartLayoutChanged do || Give big winners a gold diamond let constant layer:ChartLayer = chart.layers[1] let constant map:ChartDataMapping = {layer.get-data-mapping layer.y-axis-data[0]} let index:int = 0 {for record in sample-records do {if record["Wins"] asa int >= 6 then let constant (pos:Distance2d, y-was-null?:bool) = {map.get-position record, index} {if not y-was-null? then || Don't add shapes for records with null values. let constant size:Distance = 3 * {sqrt 2} * {layer.get-display-context}.pixel-size {layer.add {RectangleShape {GRect size, size, size, size}, translation = pos, rotation = 45deg, color = "gold", tooltip = {Tooltip {format "%s got %d wins!", record["Name"], record["Wins"] } } } } } } {inc index} } } } } {value chart} |
説明
必要な場合には、この ChartLayer を表すのに適切な X 軸を作成します。
戻り値
説明
注意事項
説明
例
例: ChartLayer.set-data-series-visibility の使用 | |
{import * from CURL.GUI.CHARTS} {import * from CHARTS-DOC, location = "../docstring-support/gui/charts-doc.scurl" } {let chart:LayeredChart = {LayeredChart width = 12cm, height = 6cm, {LineLayer sample-records, "Age", "Points", "Height", x-axis-data = {ChartDataSeries sample-records, "Name"}, symbols-at-data-points? = true } } } {value chart} {CheckButton label = "Show Age?", value = true, {on ValueFinished at cb:CheckButton do let layer:ChartLayer = chart.layers[0] {layer.set-data-series-visibility 0, cb.value} } } {CheckButton label = "Show Points?", value = true, {on ValueFinished at cb:CheckButton do let layer:ChartLayer = chart.layers[0] {layer.set-data-series-visibility 1, cb.value} } } {CheckButton label = "Show Height?", value = true, {on ValueFinished at cb:CheckButton do let layer:ChartLayer = chart.layers[0] {layer.set-data-series-visibility 2, cb.value} } } |
この ChartLayer の内部レイアウトを更新します。
説明