グラフの表示目盛りの間隔について

【ご質問】
グラフを表示したところ右縦軸の目盛り表示が、
上から「2」「1.75」「1.5」「1.25」「1」「0.75」「0.5」「0.25」「0」となりました。

目盛りには整数値のみ表示することは可能でしょうか。
また、目盛り表示間隔を制御することは可能でしょうか。

【回答】
整数のみを表示するには、”tick-label-factory”で「1.75」などの少数値の場合は、
空文字を返すようにすることで実現可能です。。

また、目盛り間隔の表示は”tick-spacing-proc”で制御することが可能です。

詳細は以下のサンプルをご参照ください。

{curl 6.0,7.0,8.0 applet}
{curl-file-attributes character-encoding = “shift-jis”}

{import * from CURL.GUI.CHARTS}

{let records:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField “Name”, domain = String},
            {RecordField “Age”, domain = double},
            {RecordField “Score”, domain = int}
        },
        {RecordData Name = “John”, Age = 1, Score = 1022},
        {RecordData Name = “Julie”,  Age = 1, Score = 1013},
        {RecordData Name = “Jethro”, Age = 1, Score = 1032},
        {RecordData Name = “Jeremy”, Age = 1, Score = 1065},
        {RecordData Name = “Jessica”, Age = 0, Score = 1093}
    }
}

{let chart:LayeredChart =
    {LayeredChart
        width = 10cm,
        height = 7cm,
        left-axis = {{NumericDataSeriesAxis-of float}
                        force-zero? = false,
                        {ChartDataSeries records, “Score”}
                    },
       
        right-axis-parent =
            {ShapeGroup
                tick-spacing-proc =
                    {proc {axis-in:ChartAxis}:(min:any, max:any, ticks:int)
                        let constant axis:{NumericAxis-of double} = axis-in asa {NumericAxis-of double}
                        let (minimum:double, maximum:double, ticks:int) =
                            {axis.calculate-tick-spacing
                                axis.minimum asa double,
                                axis.maximum asa double
                            }
                        ||=====分割数=====================
                        let space:int = 7
                        ||==============================
                       
                        {return minimum, maximum, space}
                    },
                tick-label-factory =
                    {proc {axis:ChartAxis, tick:ChartTick, tick-rotation:Angle}:any

                        ||====1.1、2.3などキリの悪い数字の場合は表示しない======
                        let ret:int =  {floor tick.value}
                        {if tick.value != ret then
                            {return “”}
                        }
                        ||=====================================
                        
                        let (halign:String, valign:String) =
                            {axis.get-tick-label-alignment tick-rotation}
                        let shape:TextShape =
                            {TextShape
                                halign = halign,
                                valign = valign,
                                color = “black”,
                                ||formatマクロを使用することにより、
                                ||目盛りの表示形式を設定できます。
                                {format “%.0f”, tick.value}
                            }
                        let bounds:GRect = {shape.get-own-bounds}
                        {return
                            {RectangleShape
                                bounds,
                                color = “white”,
                                shape
                            }
                        }
                    }
            },
       
        right-axis = {new {NumericAxis-of double}, 0, 2},
        top-axis = {ChartAxis {ChartDataSeries records, “Name”}},
        {LineLayer
            records,
            {ChartDataSeries records, “Score”},
            {ChartDataSeries records, “Age”}
        }
    }
}

{VBox
    {RecordGrid height = 4cm, width = 13cm, record-source = records},
    {spaced-hbox
        {CommandButton
            label = “commit”,
            {on Action do {records.commit}}
        },
        {CommandButton
            label = “revert”,
            {on Action do {records.revert}}
        }
    },
    chart
}