Repository navigation
Flint 1.1: Maps and better layouts #174
Chenglong Wang (Chenglong-MS)
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Flint 1.1: Layouts and Maps
TLDR: we have better maps now! and layouts are getting more robust!! :)
Details
Maps
chartProperties.boundaries): a named set, or a file of your own.fit), in a projection centred on it.projection: "orthographic"turns to face the data and hides the far side; drag to turn it.classestakesequal,jenksorcontinuous.mapStylenames a ground (atlas,dark,muted, …) or restates its colours ({ sea, land, coast, border }).level: "auto"draws states, then counties as you zoom in.orderjoins points into routes, each leg bowed with an arrowhead whose tip sits on its stop;strokeWidthsets each leg's width. A route draws a dot at its start; every stop takes a dot wheresize,shape,textor a quantity'scolorasks for one, laid beneath the lines.textnames a map's points beside them and a choropleth's regions at their middles. A crowded map names its most salient points first (the largest, or the ends of the colour scale), leaving the rest to their tooltips.Layout
canvasSizeis drawn within it: the house's chrome, the headline, keys and labels are measured first, and the plot takes the room left.detailreads as one bar: no seams between its segments, and its label shows the bar's total.Annotations
annotate-text) is a caption beside what it names, with a leader only where it stands off. The bordered card is gone; draw a callout box withset-overlay.updates(notes, overlays, emphasis, viewport), so a copied spec keeps them.set-annotationis deprecated: writeannotate-text.MCP
list_chart_typeswithchartTypereturns that type in full: what it is for, its guidance, itschartPropertiesand interaction presets.get_flint_skillservesapp(flint-app-author) for code that usesflint-chartin an app, a notebook or a script.colorsbinds colours to values per field, so a value keeps one colour on every chart and across turns.showlists what must be fixed before a chart draws apart from what it draws with.Performance
Faster compiles on large data, from Shayne Boyer (Shayne Boyer (@spboyer), #160). Each change keeps its output identical and ships with the script that measured it.
npm run benchmark:renderrecords cold and warm compile and MCP render times and memory per backend, so later changes can be compared against a baseline (perf: add reproducible compiler and MCP render baselines #171).Fixes
Reading data
"2005-05-01T00:00:00.000","…Z","2005-05-01 00:00:00", as a databaseDATEcolumn often serialises) are read as dates underYear,YearMonth,Dateand the other calendar types. A midnight timestamp becomes its date, so the axis prints short labels (Jun · Jul · Aug) instead of full timestamps. Marks sit on their date in every time zone (a Pacific machine used to draw them 7 hours late), and a time of day without a zone is labelled at the hour it says.Percentagefield holding 0.164 prints16.4%, not0.164, without needing anintrinsicDomain.Numberis not added up. A field typedNumberhas unknown additivity, so it is no longer summed or stacked by default: a bar's label or share takes the encoding'saggregate, else the mean. Type totals asCount,Amount,QuantityorProfit; an untyped numeric field still sums.Mis millions, not metres.percentScaleannotation ("fraction"or"percent") settles how a percentage is stored instead of guessing from the values. Before, a growth rate stored as 2.4 (for 240%) printed as "2.4%", and the same column could be formatted two ways depending on which rows a query returned. Axes, tooltips, domains and KPI cards all follow it (Percentage representation is guessed from the data even when intrinsicDomain is set #154).Layout and sizing
canvasSize. A Vega-Lite chart that read well only when drawn larger than its box (a key beside a full-width plot, a title over a full-height one) used to overflow and get cut off by hosts that draw the SVG at its own size. It is now laid out again for the smaller room: the plot gives up space so keys, labels and title fit. The plot keeps at least half of each side, and no value is cut or label turned to make room.canvasFit: 'off'keeps the old drawing.sortBy: "x", the NYT, Economist, Power BI, Pop and De Stijl houses drew bars in name order, because their value labels and row names sit on the same band and Vega-Lite drops a sort the layers don't share. Datawrapper's names-above-bars layout failed to compile in 1.0.1. Every layer now states the same order.options.backgroundand thebackgroundtaken by the React view, the interactive renderer andrenderSvgnow reach the chart, where Vega-Lite's default white used to win. A theme with its own canvas keeps it.Keys and labels
1M, not1000k(Compact number labels print "1000k" and "1000M" when a value rounds up to the next unit #172).−53,901,43,635); it now prints round values.Heatmaps
Date, __cell_x_end.Interactions and updates
filterControlson a chart with anaggregateencoding (average, count, sum) or several y fields used to empty the plot, because filtered rows were swapped in raw. They are now shaped the way the chart's own rows were._<field>_sort_index.validateChartaccepted were silently dropped when drawn: a numeric key on a field drawn as categories ({ Year: 2016 }on a banded year), a single-row series on a line chart (now drawn as a point a note can point at), a region caption asked to sit where it doesn't fit (now placed where it fits), and overlays withstrokeDash: 'dash'or'dot'. An overlay the renderer can't read no longer stops the chart's other updates.cartoon,pop) drew a second, full-size set beneath them.sort: null) kept the static chart's order but turned alphabetical when drawn live, recolouring every series; a faint ink's darker edge also landed on the wrong series.Annotations
pop).Themes
extendsa house and recolours its text or page takes the house's typography with it, and colours that would no longer read on the new page are adjusted. A dark page extendingnytno longer sets its title in near-black.Installing
npm install flint-chartis the whole install (flint-chart/react fails to build without every optional backend installed (dynamic imports of chart.js / plotly.js-dist-min) #155). An app no longer fails to build for want of a backend it doesn't use:flint-chartnow depends on every backend it draws with. For single-file bundles, newflint-chart/react/<backend>andflint-chart/interactive/<backend>entries carry just one library.New Contributors
Full Changelog: 1.0...1.1
This discussion was created from the release Flint 1.1: Maps and better layouts.
All reactions