question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support richer axis & legend title text layout.

See original GitHub issue

The titleAlign property does not seem to work as expected in v3.0.0-rc12. With the following spec that tries to right-align all the titles:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "data": {"url": "data/barley.json"},
  "mark": "bar",
  "encoding": {
    "x": {"aggregate": "sum", "field": "yield", "type": "quantitative", "axis": { "titleAlign": "right"}},
    "y": {"field": "variety", "type": "nominal", "axis": { "titleAlign": "right"}},
    "color": {"field": "site", "type": "nominal", "legend": { "titleAlign": "right"}}
  }
}

the output has the titles pushed leftward. They should (presumably) be aligned against the right edge of the legend/axis.

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jheercommented, Jan 29, 2019

The titleAlign field maps to the align encoding channel for a text mark. It determines only how the text is oriented relative to its x/y anchor point, it does not change that anchor point.

If you change the title position (set the title x-coordinate to the width of the legend) you can get the desired effect!

0reactions
royingcommented, Feb 6, 2019

What I meant is a way to get all the parameters (data backing) the legend from Vega view API so custom legends (and perhaps “plugins”) can be implemented in javascript (similar to Vega’s support for tooltip). For example: view.data(“mylegend”)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Format text in a legend—ArcGIS Pro | Documentation
Learn how to format and change text in a legend. ... For example, the title of the legend can be bold and a...
Read more >
Legend Title | WinForms Controls - DevExpress Documentation
To display a legend title at design time, click on the required legend within the chart to select it. Then, in the Properties...
Read more >
Title and Separator | Legend | Common Settings
The legend title is disabled by default. To enable and configure it, combine the legend() method of the chart with title() and methods...
Read more >
GGPlot Legend Title, Position and Labels - Datanovia
Change legend title; Change legend position; Reverse the order of legend items; Remove legend; Change the legend font size, color and face ...
Read more >
Customizing the Kaplan-Meier Survival Plot - SAS Support
have an increment of 0.25 and also change the Y-axis label to 'Survival': ... information about text and label attribute options, see SAS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found