resolved PR comments

This commit is contained in:
darshanr0107
2025-06-23 15:08:11 +05:30
parent 98442294ed
commit 3920ad442d
4 changed files with 11 additions and 11 deletions

View File

@@ -40,7 +40,7 @@ Drawing a pie chart is really simple in mermaid.
**Note:**
> Pie chart values must be **positive numbers greater than zero**.\
> **Zero and negative values are not allowed** and will result in an error.
> **Negative values are not allowed** and will result in an error.
\[pie] \[showData] (OPTIONAL)
\[title] \[titlevalue] (OPTIONAL)

View File

@@ -140,16 +140,16 @@ describe('pie', () => {
});
it('should handle simple pie with zero slice value', async () => {
await expect(async () => {
await parser.parse(`pie title Default text position: Animal adoption
await parser.parse(`pie title Default text position: Animal adoption
accTitle: simple pie char demo
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
"dogs" : 0
"rats" : 40.12
`);
}).rejects.toThrowError(
'"dogs" has invalid value: 0. Zero and negative values are not allowed in pie charts. All slice values must be > 0'
);
`);
const sections = db.getSections();
expect(sections.get('dogs')).toBe(0);
expect(sections.get('rats')).toBe(40.12);
});
it('should handle simple pie with negative slice value', async () => {
@@ -161,7 +161,7 @@ describe('pie', () => {
"rats" : 40.12
`);
}).rejects.toThrowError(
'"dogs" has invalid value: -60.67. Zero and negative values are not allowed in pie charts. All slice values must be > 0'
'"dogs" has invalid value: -60.67.Negative values are not allowed in pie charts. All slice values must be > 0'
);
});

View File

@@ -34,9 +34,9 @@ const clear = (): void => {
};
const addSection = ({ label, value }: D3Section): void => {
if (value <= 0) {
if (value < 0) {
throw new Error(
`"${label}" has invalid value: ${value}. Zero and negative values are not allowed in pie charts. All slice values must be > 0.`
`"${label}" has invalid value: ${value}.Negative values are not allowed in pie charts. All slice values must be > 0.`
);
}
if (!sections.has(label)) {

View File

@@ -27,7 +27,7 @@ Drawing a pie chart is really simple in mermaid.
**Note:**
> Pie chart values must be **positive numbers greater than zero**.
> **Zero and negative values are not allowed** and will result in an error.
> **Negative values are not allowed** and will result in an error.
[pie] [showData] (OPTIONAL)
[title] [titlevalue] (OPTIONAL)