mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-12 02:29:37 +02:00
formatting fixed
This commit is contained in:
@@ -42,7 +42,7 @@ export class BarPlot {
|
|||||||
fill: barData.fill,
|
fill: barData.fill,
|
||||||
strokeWidth: 0,
|
strokeWidth: 0,
|
||||||
strokeFill: barData.fill,
|
strokeFill: barData.fill,
|
||||||
}
|
};
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -57,8 +57,8 @@ export class BasePlot implements Plot {
|
|||||||
throw Error('Axes must be passed to render Plots');
|
throw Error('Axes must be passed to render Plots');
|
||||||
}
|
}
|
||||||
const drawableElem: DrawableElem[] = [];
|
const drawableElem: DrawableElem[] = [];
|
||||||
const linePlots = this.chartData.plots.filter(plot => plot.type === 'line') as LinePlotData[];
|
const linePlots = this.chartData.plots.filter((plot) => plot.type === 'line') as LinePlotData[];
|
||||||
const barPlots = this.chartData.plots.filter(plot => plot.type === 'bar') as BarPlotData[];
|
const barPlots = this.chartData.plots.filter((plot) => plot.type === 'bar') as BarPlotData[];
|
||||||
|
|
||||||
let plotIndex = 0;
|
let plotIndex = 0;
|
||||||
if (linePlots.length) {
|
if (linePlots.length) {
|
||||||
|
@@ -335,10 +335,9 @@ describe('Testing xychart jison file', () => {
|
|||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
||||||
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith([[
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
{ text: 'barTitle', type: 'text' },
|
[{ text: 'barTitle', type: 'text' }, [23, 45, 56.6, 0.22]],
|
||||||
[23, 45, 56.6, 0.22]
|
]);
|
||||||
]]);
|
|
||||||
});
|
});
|
||||||
it('parse bar Data spaces and +,- symbol', () => {
|
it('parse bar Data spaces and +,- symbol', () => {
|
||||||
const str =
|
const str =
|
||||||
@@ -346,10 +345,9 @@ describe('Testing xychart jison file', () => {
|
|||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
||||||
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith([[
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
{ text: 'barTitle with space', type: 'text' },
|
[{ text: 'barTitle with space', type: 'text' }, [23, -45, 56.6]],
|
||||||
[23, -45, 56.6]
|
]);
|
||||||
]]);
|
|
||||||
});
|
});
|
||||||
it('parse bar Data without plot title', () => {
|
it('parse bar Data without plot title', () => {
|
||||||
const str =
|
const str =
|
||||||
@@ -392,18 +390,12 @@ describe('Testing xychart jison file', () => {
|
|||||||
expect(parserFnConstructor(str)).not.toThrow();
|
expect(parserFnConstructor(str)).not.toThrow();
|
||||||
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
expect(mockDB.setYAxisTitle).toHaveBeenCalledWith({ text: 'yAxisName', type: 'text' });
|
||||||
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
expect(mockDB.setXAxisTitle).toHaveBeenCalledWith({ text: 'xAxisName', type: 'text' });
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith([[
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
{ text: 'barTitle1', type: 'text' },
|
[{ text: 'barTitle1', type: 'text' }, [23, 45, 56.6]],
|
||||||
[23, 45, 56.6]
|
]);
|
||||||
]]);
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith(
|
[{ text: 'barTitle2', type: 'text' }, [13, 42, 56.89]],
|
||||||
[
|
]);
|
||||||
[
|
|
||||||
{ text: 'barTitle2', type: 'text' },
|
|
||||||
[13, 42, 56.89]
|
|
||||||
],
|
|
||||||
],
|
|
||||||
);
|
|
||||||
expect(mockDB.setLineData).toHaveBeenCalledWith(
|
expect(mockDB.setLineData).toHaveBeenCalledWith(
|
||||||
{ text: 'lineTitle1', type: 'text' },
|
{ text: 'lineTitle1', type: 'text' },
|
||||||
[11, 45.5, 67, 23]
|
[11, 45.5, 67, 23]
|
||||||
@@ -432,14 +424,12 @@ describe('Testing xychart jison file', () => {
|
|||||||
{ text: 'category 2', type: 'text' },
|
{ text: 'category 2', type: 'text' },
|
||||||
{ text: 'category3', type: 'text' },
|
{ text: 'category3', type: 'text' },
|
||||||
]);
|
]);
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith([[
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
{ text: 'barTitle1', type: 'text' },
|
[{ text: 'barTitle1', type: 'text' }, [23, 45, 56.6]],
|
||||||
[23, 45, 56.6]
|
]);
|
||||||
]]);
|
expect(mockDB.setBarData).toHaveBeenCalledWith([
|
||||||
expect(mockDB.setBarData).toHaveBeenCalledWith([[
|
[{ text: 'barTitle2', type: 'text' }, [13, 42, 56.89]],
|
||||||
{ text: 'barTitle2', type: 'text' },
|
]);
|
||||||
[13, 42, 56.89]
|
|
||||||
]]);
|
|
||||||
expect(mockDB.setLineData).toHaveBeenCalledWith(
|
expect(mockDB.setLineData).toHaveBeenCalledWith(
|
||||||
{ text: 'lineTitle1', type: 'text' },
|
{ text: 'lineTitle1', type: 'text' },
|
||||||
[11, 45.5, 67, 23]
|
[11, 45.5, 67, 23]
|
||||||
|
@@ -172,7 +172,7 @@ function setLineData(title: NormalTextType, data: number[]) {
|
|||||||
type NamedDataset = [title: NormalTextType, data: number[]];
|
type NamedDataset = [title: NormalTextType, data: number[]];
|
||||||
|
|
||||||
function setBarData(datasets: NamedDataset[]) {
|
function setBarData(datasets: NamedDataset[]) {
|
||||||
datasets.forEach(dataset => {
|
datasets.forEach((dataset) => {
|
||||||
const plotData = transformDataWithoutCategory(dataset[1]);
|
const plotData = transformDataWithoutCategory(dataset[1]);
|
||||||
xyChartData.plots.push({
|
xyChartData.plots.push({
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
Reference in New Issue
Block a user