グラフの凡例のcaption変更

【ご質問】
グラフについて、凡例のcaptionのみを変更する方法はありますか。

【回答】
legend-entry-factoryを使用する事で、凡例のcaptionの変更が行えます。

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

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

{import * from CURL.GUI.CHARTS}

{let record-set:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField “Name”, domain = String},
            {RecordField “Age”, domain = int},
            {RecordField “Win”, domain = int}
        },
        {RecordData Name = “AAA”, Age = 12},
        {RecordData Name = “BBB”, Age = 21},
        {RecordData Name = “CCC”, Age = 43},
        {RecordData Name = “DDD”, Age = 22}                             
    }
}

{let chart:LayeredChart =
    {LayeredChart
        width = 10cm,
        {BarLayer
            record-set,
            “Age”,
            x-axis-data = {ChartDataSeries record-set, “Name”}
        },
        ||legend-entry-factoryを使用して、凡例の作成を行います。
        legend-entry-factory =
            {proc {chart:Chart,
                      data-series:ChartDataSeries,
                      record:#Record,
                      color:FillPattern,
                      legend-index:int
                    }:Graphic
                {return
                    {HBox
                        valign = “center”,
                        {Fill
                            width = 8pt,
                            height = 8pt,
                            background = color,
                            border-width = 1px
                        },
                        {Fill width = {make-elastic minimum-size = 20pt}},
                        ||captionが”Age”だった場合、”年齢”と凡例に表示させる
                        {if data-series.field.caption == “Age”
                         then
                            “年齢”
                         else
                            data-series.field.caption
                        }
                    }
                }
            }
    }
}

{View
    chart,
    visibility = “normal”,
    {on WindowClose do
        {exit}
    }
}