UNPKG

@microsoft/teams.cards

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta

1 lines 4.61 kB
{"version":3,"sources":["../../src/charts/line.ts"],"names":[],"mappings":";;AA8BO,MAAM,kBAAkB,OAA8B,CAAA;AAAA,EAC3D,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,QAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA,EAEA,eAAe,IAAwB,EAAA;AACrC,IAAM,KAAA,EAAA;AACN,IAAA,IAAA,CAAK,IAAO,GAAA,YAAA;AACZ,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AAAA;AACd,EAEA,YAAY,KAAyB,EAAA;AACnC,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,KAAK,CAAA;AACzB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAAe,EAAA;AACvB,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,aAAa,KAAe,EAAA;AAC1B,IAAA,IAAA,CAAK,QAAW,GAAA,KAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,WAAW,IAAwB,EAAA;AACjC,IAAK,IAAA,CAAA,IAAA,CAAK,IAAK,CAAA,GAAG,IAAI,CAAA;AACtB,IAAO,OAAA,IAAA;AAAA;AAEX;AAqBO,MAAM,aAAwC,CAAA;AAAA;AAAA;AAAA;AAAA,EAInD,KAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA,EAEA,eAAe,UAAmC,EAAA;AAChD,IAAA,IAAA,CAAK,MAAS,GAAA,UAAA;AAAA;AAChB,EAEA,YAAY,KAA6B,EAAA;AACvC,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,KAAK,CAAA;AACzB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,UAAU,KAAmB,EAAA;AAC3B,IAAA,IAAA,CAAK,KAAQ,GAAA,KAAA;AACb,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,WAAW,KAAe,EAAA;AACxB,IAAA,IAAA,CAAK,MAAS,GAAA,KAAA;AACd,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,iBAAiB,KAA8B,EAAA;AAC7C,IAAK,IAAA,CAAA,MAAA,CAAO,IAAK,CAAA,GAAG,KAAK,CAAA;AACzB,IAAO,OAAA,IAAA;AAAA;AAEX;AAcO,MAAM,kBAAkD,CAAA;AAAA;AAAA;AAAA;AAAA,EAI7D,CAAA;AAAA;AAAA;AAAA;AAAA,EAKA,CAAA;AAAA,EAEA,WAAA,CAAY,GAAoB,CAAW,EAAA;AACzC,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA;AACT,IAAA,IAAA,CAAK,CAAI,GAAA,CAAA;AAAA;AAEb","file":"line.mjs","sourcesContent":["import { IElement, Element } from '../base';\n\nimport { ChartColor } from './color';\n\nexport interface ILineChart extends IElement {\n type: 'Chart.Line';\n\n /**\n * the title of the chart.\n */\n title?: string;\n\n /**\n * the color to use for all data points.\n */\n color?: ChartColor;\n\n /**\n * the name of the set of colors to use.\n */\n colorSet?: string;\n\n /**\n * the data to display in the chart.\n */\n data: ILineChartData[];\n}\n\nexport type LineChartOptions = Omit<ILineChart, 'type' | 'data'>;\n\nexport class LineChart extends Element implements ILineChart {\n type: 'Chart.Line';\n\n /**\n * the title of the chart.\n */\n title?: string;\n\n /**\n * the color to use for all data points.\n */\n color?: ChartColor;\n\n /**\n * the name of the set of colors to use.\n */\n colorSet?: string;\n\n /**\n * the data to display in the chart.\n */\n data: ILineChartData[];\n\n constructor(...data: ILineChartData[]) {\n super();\n this.type = 'Chart.Line';\n this.data = data;\n }\n\n withOptions(value: LineChartOptions) {\n Object.assign(this, value);\n return this;\n }\n\n withTitle(value: string) {\n this.title = value;\n return this;\n }\n\n withColorSet(value: string) {\n this.colorSet = value;\n return this;\n }\n\n addData(...data: ILineChartData[]) {\n this.data.push(...data);\n return this;\n }\n}\n\nexport interface ILineChartData {\n /**\n * the color to use for the data point.\n */\n color?: ChartColor;\n\n /**\n * the legend of the chart.\n */\n legend?: string;\n\n /**\n * the data points in the series.\n */\n values: ILineChartDataPoint[];\n}\n\nexport type LineChartDataOptions = Omit<ILineChartData, 'values'>;\n\nexport class LineChartData implements ILineChartData {\n /**\n * the color to use for the data point.\n */\n color?: ChartColor;\n\n /**\n * the legend of the chart.\n */\n legend?: string;\n\n /**\n * the data points in the series.\n */\n values: ILineChartDataPoint[];\n\n constructor(...dataPoints: ILineChartDataPoint[]) {\n this.values = dataPoints;\n }\n\n withOptions(value: LineChartDataOptions) {\n Object.assign(this, value);\n return this;\n }\n\n withColor(value: ChartColor) {\n this.color = value;\n return this;\n }\n\n withLegend(value: string) {\n this.legend = value;\n return this;\n }\n\n addDataPoints(...value: ILineChartDataPoint[]) {\n this.values.push(...value);\n return this;\n }\n}\n\nexport interface ILineChartDataPoint {\n /**\n * the x axis value of the data point.\n */\n x: number | string;\n\n /**\n * the y axis value of the data point.\n */\n y: number;\n}\n\nexport class LineChartDataPoint implements ILineChartDataPoint {\n /**\n * the x axis value of the data point.\n */\n x: number | string;\n\n /**\n * the y axis value of the data point.\n */\n y: number;\n\n constructor(x: number | string, y: number) {\n this.x = x;\n this.y = y;\n }\n}\n"]}