Skip to content

Commit

Permalink
update to jvision v1.2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
GCS-ZHN committed Jul 21, 2022
1 parent 2be23ed commit ad2cca4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 10 additions & 2 deletions Java/socube_vision/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/gcs-zhn/jvision</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>top.gcszhn</groupId>
<artifactId>jvision</artifactId>
<version>1.1</version>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
Expand Down
15 changes: 10 additions & 5 deletions Java/socube_vision/src/test/java/top/gcszhn/test/PlotTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package top.gcszhn.test;
import top.gcszhn.jvision.RingDiagram;
import top.gcszhn.jvision.JvisionException;
import top.gcszhn.jvision.chart.RingDiagram;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand All @@ -11,12 +12,13 @@

public class PlotTest {
@Test
public void test() throws IOException {
public void test() throws IOException, JvisionException {
String configStr;
try (FileInputStream input = new FileInputStream("data/config.json")) {
configStr = new String(input.readAllBytes());
}
int width = 600, height = 600;
String fontFamily = "Calibri";
int df = 15;
float[] radioRange = new float[]{50, 200};
int startAngle = 90, arcAngle = -(360 - 360 / df);
Expand Down Expand Up @@ -44,9 +46,10 @@ public void test() throws IOException {
arcAngle,
(valueRange[1]-valueRange[0]) / step,
balance);
ringDiagram.setFontFamily(fontFamily);
ringDiagram.loadData(String.format("data/data-precision-%s.csv", type));
ringDiagram.draw(String.format("data/data-precision-%s.%s", type, format));
} catch (RuntimeException e) {
} catch (JvisionException e) {
if (e.getCause() instanceof FileNotFoundException) {
System.out.println(e.getCause().getMessage());
} else {
Expand All @@ -73,9 +76,10 @@ public void test() throws IOException {
arcAngle,
(valueRange[1]-valueRange[0]) / step,
balance);
ringDiagram.setFontFamily(fontFamily);
ringDiagram.loadData(String.format("data/data-recall-%s.csv", type));
ringDiagram.draw(String.format("data/data-recall-%s.%s", type, format));
} catch (RuntimeException e) {
} catch (JvisionException e) {
if (e.getCause() instanceof FileNotFoundException) {
System.out.println(e.getCause().getMessage());
} else {
Expand All @@ -102,9 +106,10 @@ public void test() throws IOException {
arcAngle,
(valueRange[1]-valueRange[0]) / step,
balance);
ringDiagram.setFontFamily(fontFamily);
ringDiagram.loadData(String.format("data/data-TNR-%s.csv", type));
ringDiagram.draw(String.format("data/data-TNR-%s.%s", type, format));
} catch (RuntimeException e) {
} catch (JvisionException e) {
if (e.getCause() instanceof FileNotFoundException) {
System.out.println(e.getCause().getMessage());
} else {
Expand Down

0 comments on commit ad2cca4

Please sign in to comment.