- Modify the
repository
url per publint's recommendation.
2024-10-31
- Add
homepage
,repository
anddescription
field to package.json
2024-10-19
2024-06-23
Better types.
2024-06-23
Add SvelteKit default settings for prettier and eslint with a few exceptions.
2024-06-23
Fixes a problem where if a user niced one of their scales, that change would not be reflected in the _Domain stores. Many thanks to @jnsprnw for the fix!
2024-06-22
Security update
2024-06-04
A very minor update. This adds an index variable i
to key accessor functions mostly for consistency with the callback signature of a for-loop and to support possible unorthodox arrangments where a row is accessed not from $data
but from somethingElse[i]
in the accessor function.
2024-05-17
Adds an option to suppress layout warnings. By default, Layer Cake warns you when you create a div that is too small. But sometimes you want to create a chart inside a hidden element or something and make the chart expand. In these cases, the warnings are annoying.
2024-05-06
Rebuilt the lockfile because of this issue with GitHub CI. Bumping to a new version just so everyone has the same lockfile.
- ec415109dc871476f3e4f3756eec52999396a83f
- 0eb3acd71459cbcfd81336e080bb48b90d5be1e3
- 14a1ad3fc528c9c5eac2bcdcc768035bf871c83b
2024-05-06
Make compatible with Svelte 5. Note: This does not update the API to use runes, eliminate the use of stores or get rid of reactive statements. Thanks to @rgieseke for the help on this!
2024-04-24
Excludes flatData
from the debug printout if it's null.
2024-03-12
Following up on 8.0.3, adds flatData
to the debug printout.
2024-03-11
This adds xDomainSort
, yDomainSort
, zDomainSort
and rDomainSort
props that will kick in when the scale is ordinal. By default, unique value calculations return a sorted list. You can now use these props to set that to false
and return the uniques in the order they appeared in the data.
Also updates the API to calcUniques
helper function to also accept field-specific sort instructions.
2024-03-07
Also print the data
object when debug
is set.
2023-10-14
Corrects the change in 8.0.0 for sorting a domain by adding a comparator function to better sort strings and dates. Also fixes an oversight where domains that were dates would not be calculated uniquely. Also some security upgrades. Closes #151
Note: Due to a publishing error, there is no 8.0.1
2023-09-19
When calculating uniques for an ordinal scale's domain, sort the list. This will help in case your input data changes order, in which case your colors may be off (if using that dimension for a color scale). This is technically a breaking change although it may not actually affect any live charts.
2023-07-19
Fixes JSDoc types to allow for null
values in the xDomain
, yDomain
etc. props. Thanks @rgieseke!
2023-06-27
Upgrade to Svelte 4.0. Set version 3 and 4 as a peer dep.
2023-06-25
Add accessibility props to layout components.
2023-04-15
Expose context values as slot props. Make the defaults for yReverse
reactive post-load.
2023-04-04
Dependabot fix
2023-03-17
Bring back the "main": "./dist/index.js",
field in package.json
for legacy build systems.
2023-03-17
Align values better in print debug output.
2023-03-17
Cut down on dependencies by using d3-color for contrast detection
2023-03-16
Adds the debug-mode
prop. Note: 7.3.0 was skipped because of an npm error.
2023-03-16
Correct the types on the xDomain
, rDomain
, zDomain
, rDomain
props to reflect that the values can be null
to inherit the calculated min or max. Updates svelte-package
and package.json
to use exports
field. Adds Typescript 5 as a peerDep
.
2022-12-26
Add the d3-shape
and d3-array
as dependencies to handle new helper functions. Note: 7.2.1 was skipped because of an npm error.
2022-12-23
This release adds new functions: bin
, stack
, groupLonger
and takeEvery
. It also adds a new second argument to flatten
.
2022-10-03
Allow for all nNice
props to take a number instead of just a boolean.
2022-07-10
This release has a few new features that should make for nicer default charts when working with ordinal scales. Many thanks to @techniq for kicking things off with this. Here are the highlights:
- When setting a
scaleBand
orscalePoint
scale, theyRange
is no longer reversed by default PR #85. - If the scale already has a custom interpolator function, don't set the range. This helps when using
scaleSequential
andscaleDiverging
for a color scale. Interpolators are kind of like ranges but set with a different method. Before, any custom interpolator you set when passing in the scale would get overridden when the range was set automatically PR #89. - If setting a
scaleOrdinal
,scaleBand
orscalePoint
, the calculated extents will be a series of unique values instead of[min, max]
PR #90. - A new function called
calcUniques
which has the same API ascalcExtents
but calculates unique values instead of mins and maxes.
This is technically a breaking change because the behavior is different but the only real change you would see would be the order of an ordinal y scale will be unreversed – which may be more correct than what it was previously.
2022-07-10
Makes a more helpful error message when the data passed into calcExtents
isn't an array.
2022-06-24
Fixes some typos in documentation
2022-02-22
This adds an innerElement
prop you can bind to on the <Svg>
component that lets you bind to the <g>
element. Mostly this release improves reactivity by setting initial values for store values and changing the syntax from using .set
to using assignments, which apparently helps Svelte understand the topology. This should lead to fewer re-renders. It also will only warn about negative dimensions on the parent container once DOM elements are mounted. So you won't get a warning because the code was executed before the DOM was able to measure it. This release improves layout components by using new style directives.
- 4530774c759114fd8de0854542fa162b694a5c7c
- 85684a94c9cf79b204e1453723e97b7853ed2af6
- c51506ad0e45718962ccabb831b9408bfe82009a
- 28a1f9e92e39464111055f27801a0af45583df26
2022-01-19
Fill in a misssing documentation line for the padding
prop.
2022-01-16
Layer Cake is now built with SvelteKit and the website is included in this repo instead of the layercake.graphics repo. This is a new major version since that seemed like a clean way to separate out any problems that might arise from the SvelteKit build process but there shouldn't actually be any breaking changes. One new feature is you'll now get TypeScript type hints when using the library (powered by JSDoc comments). Many thanks to everyone who helped](#58) sort out best practices for that. There are a lot of commits in this release so instead of including them all here, here's the diff between this release and 5.0.3: https://github.com/mhkeller/layercake/compare/v5.0.3...v6.0.0
2021-12-14
Fix an extra argument that was causing the aspectRatio
context val to be NaN
. PR #55 from @techniq to add "svelte": "src/index.js"
to package.json, fixes #54.
2021-12-08
PR from @benmccann to add type: "module"
in package.json to modernize and rename master branch to main.
2021-11-24
A minor internal change where calcExtents
is only called when there are active keys. This change preempts an error where a zGet
function was optionally called in the Map component. Because zGet
existed in the component, the library was running this bit of code. The calcExtents
resulted in an error because the data was a geojson object, not an array. Adding this check will allow components that don't necessarily use getters to include references to those functions so they are more reusable.
2021-06-20
Breaking change: The API to calcExtents
now takes an object instead of an array of objects. See this issue for more info. Many thanks to @jtrim-ons for taking the initiative on this!
This shouldn't change much since this is mostly an internal function. If you've used the example components for the Small Multiples or Timeplot graphics, take a look here on how to update those components to conform with the new API.
The old API took an array of objects for the fields
variable like this:
[
{
{ field: 'x', accessor: d.myX },
{ field: 'y', accessor: d.myY },
{ field: 'z', accessor: d.myZ },
{ field: 'r', accessor: d.myR }
]
Now it takes an object like this:
{
x: d.myX,
y: d.myY,
z: d.myZ,
r: d.myR
}
The function returns the same object as before.
2020-06-29
Thanks to @jtrim-ons for this PR, the uniques calculation now uses a Set to test for uniqueness, which is much faster. Issue #46.
2021-03-17
Export the layout component elements and any canvas contexts as bindable variables and also as slot props. It also updates the scaleCanvas
component to no longer need the deprecated backingPixelStore
value.
- ce4b5a4ade801d97e37e0626003ae7a457102cfc
- 8de7732247d5bfc6c29ec53c45c27dd344644b59
- 97c6094fb47cb455790cb9f561a410f12c00d857
- 9350d3f7d6541973af09e7fb19b390bfcadb633f
2021-02-22
Also issue a warning if container dimensions are zero, not just negative.
2020-11-27
Fixes an issue where it would throw an error if you set a manual domain and data
was an empty array.
2020-11-23
Add a warning if you're trying to use domain padding and you have a domain or range that isn't an array with two items.
2020-11-23
The layouts
folder got renamed to Layouts
. Fix that so imports don't get confused.
2020-11-22
This changes how scale padding works by a) correcting the calculation so that it's actually accurate (before it was off by a little bit for small amounts and a lot for large amounts) and b) adds support so you can use padding for non-linear scales (log, power, symlog etc.).
It's a breaking change but only if you're using xPadding
, yPadding
or zPadding
and even then, it will likely only adjust by a few pixels. Closes #17.
- 89f317c09ac046e10ac354e521241e6a4f6245ed
- 796911d5de2e944ac5180299020457211f3e8958
- 65f2309bed594cc96fb94cc5500b4518c85a8264
2020-06-19
Remove undefined
fields passed into extents
prop.
2020-06-17
Create the extents
<LayerCake>
prop that allows for manually setting extents. This also includes a patch to ignore null
and NaN
values when calculating extents in addition to undefined
. This patch shouldn't be a breaking change since the chart would not have worked if you had those values in your data.
2020-06-15
A number of neat features including support for server-side rendering, the new raise
helper for better SVG helpers, defaulting to position: relative
for layercake-container
, aspect ratios, viewbox options, allowing a cake to be position: absolute;
, expose some variables as slot values, adds a defs slot to svg layout components, use the prop config
instead of originalSettings
and expose range arrays as props.
- cb35d277aef34a32d8f811c563b9c62f9366c86a
- 9f93db589eb10b73c4fe4044ef45a8b1e594db56
- fb454b8d328aa2407e0df057ad0e7d2b6a5bb5bc
- c46fae42ebc44a14d89e265ebe8d7dc8b18f0fa7
- fd9e3e1b7ddb28f57f39355f59c74d98d29a1999
- df01f6a420f459a70cedb3a65997b5f2589e0259
- 44c546c15b751da2a674749ce7d3f9cc56cff3fa
- 4396eb6dd3be33d58d3a343c04a319af69404956
- 0871e9b725a0994a1e880e804166a08f08dafc11
- b37dbcd1d1e8016d330d733eeafc7de15e4202ee
- dfe35d986e4062baf5a07610574d78bf6aaad287
- 5d36bff218a3c0be11cdd8167d45495e3350fc1d
- ca001628c158216f71a6d62c1c2499e620575b4d
- bd18a5a51996ce0123b368e54f86f39068ef60de
- 7f586d8c82dd231f24979e6df504bac04cf49270
- ae6de4a55635199fd972334364d6855258920e5d
- 5224ecb7cb32b8c4104b0be79f88bb51c1218edf
Rename WebGL component's contextOptions
prop to contextAttributes
to reflect the WebGL documentation.
Access the ctx
object off of the Canvas component as const ctx = getContext('canvas')
instead of const ctx = getContext('ctx')
, which was a little confusing.
Rename originalSettings
to config
2020-01-26
Add back the 1.x dot files, including an .npmignore
2020-01-23
The Tres Leches edition. Complete rewrite to use Svelte 3! It's now a component based interface and is a lot more intuitive to compose graphics. The API options are pretty much the same. Some notable changes:
- reverse range functions are now
xReverse
instead ofreverseX
- There's an added z-scale to give more options. Examples in the works.
- Domain padding is fixed per #11
2020-01-23
Push to 1.x so that past versions are stable. Prepare for launch of version 2.x. Archive this branch at https://github.com/mhkeller/v1.layercake.
2019-03-26
Add custom ranges and some more tests
- Add custom ranges for x, y and r scales
- Add test for calcExtent when the accessor returns an array
2019-03-13
Update dependencies to fix minor lodash security problem
- Update lodash
2018-12-23
Some small things
- Add
main
field to package.json. Closes #6. - Add warning if scale does not support
.nice()
2018-10-20
Change the default behavior of uniques
since most frequently we'll want it to transform.
- Default to true, change tests
2018-10-20
Add uniques
as a helper export.
- Add
src/lib/uniques.js
and tests
2018-10-18
Let calcExtents
measure extents of string values. Various small tweaks for publication.
- Add string value support to
calcExtents
- Fix readme logo
- Install instructions for devDependencies
- More
.npmignore
additions
2018-10-17
Add to .npmignore
.
- Add
test
folder npm ignore
2018-10-17
Initial release