use union type for DashType

This commit is contained in:
peter
2017-08-10 09:20:31 +08:00
parent 1cefa50242
commit 71b2d06917
2 changed files with 9 additions and 34 deletions

View File

@@ -17,6 +17,7 @@ let columnChart = new CanvasJS.Chart("chartContainer",
data: [
{
type: "column",
lineDashType:"longDash",
showInLegend: true,
legendMarkerColor: "grey",
legendText: "MMbbl = one million barrels",

View File

@@ -3,6 +3,8 @@
// Definitions by: ShuYin Zhang <https://github.com/brutalimp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type DashType = "solid" | "shortDash" | "shortDot" | "shortDashDot" | "shortDashDotDot" | "dot" | "dash" | "dashDot" | "longDash" | "longDashDot" | "longDashDotDot"
declare namespace CanvasJS {
class Chart {
/**
@@ -693,20 +695,8 @@ declare namespace CanvasJS {
/**
* Sets the dash type for axisY.
* Default: "solid"
* Supported Dash Types:
* “solid”
* “shortDash”
* “shortDot”
* “shortDashDot”
* “shortDashDotDot”
* “dot”
* “dash”
* “dashDot”
* “longDash”
* “longDashDot”
* “longDashDotDot”
*/
lineDashType?: string;
lineDashType?: DashType;
/**
* Sets the minimum value of Axis. Values smaller than minimum are clipped. minimum also sets the lower limit while panning chart.
* Default: Automatically Calculated based on the data.
@@ -842,9 +832,8 @@ declare namespace CanvasJS {
/**
* Sets the Dash Type for stripLine.
* Default: solid
* Example: “dot”, “dash”, etc.
*/
lineDashType?: string;
lineDashType?: DashType;
/**
* Sets opacity of stripLine.
* Default: null
@@ -1044,9 +1033,8 @@ declare namespace CanvasJS {
/**
* Sets the Dash Type for grid lines on axisX.
* Default: solid
* Options: “solid”, “shortDash”, “shortDot”, “shortDashDot”, “shortDashDotDot”, “dot”, “dash”, “dashDot”, “longDash”, “longDashDot”, “longDashDotDot”
*/
gridDashType?: string;
gridDashType?: DashType;
/**
* A custom formatter function that returns label to be displayed on axisX.
* Notes:
@@ -1286,9 +1274,8 @@ declare namespace CanvasJS {
* Sets the Dash Type for indexLabels line. It is applicable only for pie and doughnut charts when indexLabelPlacement is set to “outside”.
* For other chart-types, indexLabelLineThickness should be set greater than zero.
* Default: solid
* Example: “dot”, “dash”, etc.
*/
indexLabelLineDashType?: string;
indexLabelLineDashType?: DashType;
/**
* A custom formatter function which returns the text to be displayed as indexLabel on dataPoints.
* @param e event object
@@ -1606,9 +1593,8 @@ declare namespace CanvasJS {
/**
* Sets the Line Dash Type for all Line and Area Charts.
* Default: solid
* Example: “dot”, “dash”, etc.
*/
lineDashType?: string;
lineDashType?: DashType;
/**
* Sets the Line Dash Type of line wherever null data is present.
* Note:
@@ -1616,20 +1602,8 @@ declare namespace CanvasJS {
* 2.Supported with all Line and Area Charts.
* 3.Not Supported on IE8.
* Default: "dash"
* Supported Line Dash Types:
* “solid”
* “shortDash”
* “shortDot”
* “shortDashDot”
* “shortDashDotDot”
* "dot"
* “dash”
* “dashDot”
* “longDash”
* “longDashDot”
* “longDashDotDot”
*/
nullDataLineDashType?: string;
nullDataLineDashType?: DashType;
}
interface ChartDataSeries extends ChartDataSeriesOptions {