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