legend

defines the configuration of a chart legend

object legend;

Example

var chart = new dhx.Chart("chart_container",{
    scales: {
        // scales config
    },
    series: [
        // list of series 
    ],
    legend: {
        series: ["A", "B", "C"],
        valign: "top",
        halign: "right"
    }    
});

Related samples

Details

The list of config options for legend (for charts with scales)

  • form - (string) the form of the legend markers ("rect" or "circle")
    Related sample:  Chart. Legend Form
  • itemPadding - (number) padding between legend items
  • halign - (string) the horizontal alignment of the legend block: "left"|"right"|"center"
  • valign - (string) the vertical alignment of the block: "top"|"bottom"|"middle"
  • series - (array) the list of series that should be shown in the legend
  • margin - (number) margin between the scale and the legend

The list of config options for legend (for charts without scales: Pie, Pie3D, Donut)

  • values - (object) maps attributes of legend items to data set properties. Contains the following properties:
    • id - (string,number) the id of the series that will be bound to the legend
    • text - (string) the pointer to the data value to take a text for the legend from
    • color - (string) the pointer to the data value to take a color for the legend from
    • alpha - (number) transparency of a legend item
  • form - (string) the form of the legend markers ("rect" or "circle")
  • itemPadding - (number) padding between legend items
  • halign - (string) the horizontal alignment of the legend block: "left"|"right"|"center"
  • valign - (string) the vertical alignment of the block: "top"|"bottom"|"middle"
  • margin - (number) margin between the scale and the legend
See also
Back to top