{"size": 1607, "ext": "js", "max_stars_repo_path": "test/plots/legend-symbol.js", "max_stars_repo_name": "datalayer-externals/observablehq-plot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/plots/legend-symbol.js", "max_issues_repo_name": "datalayer-externals/observablehq-plot", "max_issues_repo_issues_event_min_datetime": "2021-10-02T07:19:44.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-24T00:07:04.000Z", "max_forks_repo_path": "test/plots/legend-symbol.js", "max_forks_repo_name": "admariner/plot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 20, "max_forks_count": null, "avg_line_length": 36.5227272727, "max_line_length": 102, "alphanum_fraction": 0.7143746111}
import * as Plot from "@observablehq/plot";

export function symbolLegendBasic() {
  return Plot.legend({symbol: {domain: "ABCDEF"}});
}

export function symbolLegendColorFill() {
  return Plot.legend({color: {domain: "ABCDEF"}, symbol: {domain: "ABCDEF"}, fill: "color"});
}

export function symbolLegendColorStroke() {
  return Plot.legend({color: {domain: "ABCDEF"}, symbol: {domain: "ABCDEF"}});
}

export function symbolLegendFill() {
  return Plot.legend({symbol: {domain: "ABCDEF"}, fill: "red"});
}

// Note: The symbol hint requires reference equality for channel definitions,
// and so doesn’t consider the fill and symbol channels to be using the same
// encoding here.
export function symbolLegendDifferentColor() {
  return Plot.dotX("ABCDEF", {fill: d => d, symbol: d => d}).plot().legend("symbol");
}

// Note: The symbol hint requires reference equality for channel definitions,
// and so doesn’t consider the fill and symbol channels to be using the same
// encoding here.
export function symbolLegendExplicitColor() {
  return Plot.dotX("ABCDEF", {fill: d => d, symbol: d => d}).plot().legend("symbol", {fill: "color"});
}

// Note: The symbol hint requires reference equality for channel definitions; we
// can tell the mark that they represent the same encoding by passing the same
// function for both channels.
export function symbolLegendImplicitRange() {
  const identity = d => d;
  return Plot.dotX("ABCDEF", {fill: identity, symbol: identity}).plot().legend("symbol");
}

export function symbolLegendStroke() {
  return Plot.legend({symbol: {domain: "ABCDEF"}, stroke: "red"});
}
