c3: add missing fields in LegendOptions

There is configuration for tiles introduced with
https://github.com/c3js/c3/issues/1033 and defined in
spec/legend-spec.js which is missing from @types/c3.
This commit is contained in:
Tim Niemueller
2018-04-06 00:30:35 +02:00
parent db7a840e4f
commit fa2aeb9317
2 changed files with 39 additions and 1 deletions

View File

@@ -1798,6 +1798,26 @@ function legend_custom() {
});
}
function legend_tiles() {
const chart = c3.generate({
data: {
columns: [
["sample", 30, 200, 100, 400, 150, 250]
]
},
legend: {
// amount of padding to put between each legend element
padding: 5,
// define custom height and width for the legend item tile
item: {
tile: {
width: 15,
height: 2
}
}
}});
}
/////////////////////
// Tooltip Tests
/////////////////////

20
types/c3/index.d.ts vendored
View File

@@ -1,9 +1,10 @@
// Type definitions for C3js 0.5
// Type definitions for C3js 0.6
// Project: http://c3js.org/
// Definitions by: Marc Climent <https://github.com/mcliment>
// Gerin Jacob <https://github.com/gerinjacob>
// Bernd Hacker <https://github.com/denyo>
// Dzmitry Shyndzin <https://github.com/dmitryshindin>
// Tim Niemueller <https://github.com/timn>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -700,6 +701,10 @@ export interface LegendOptions {
y?: number;
step?: number;
};
/**
* Padding between legend elements.
*/
padding?: number;
item?: {
/**
@@ -714,6 +719,19 @@ export interface LegendOptions {
* Set mouseout event handler to the legend item.
*/
onmouseout?(id: any): void;
/**
* Tile settings for legend color display.
*/
tile?: {
/**
* Tile width.
*/
width?: number;
/**
* Tile height
*/
height?: number;
}
};
}