Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>com.tdunning</groupId>
<artifactId>json</artifactId>
<version>1.6</version>
<groupId>com.github.openjson</groupId>
<artifactId>openjson</artifactId>
<version>1.0.8</version>
</dependency>
</dependencies>

Expand Down
35 changes: 19 additions & 16 deletions src/main/java/br/com/digilabs/jqplot/data/AreaFillData.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Inaiat H. Moraes.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -20,14 +20,14 @@
import java.util.Collection;
import java.util.List;

import org.json.JSONArray;
import com.github.openjson.JSONArray;

/**
* Data Helper to build Area Charts.
*
*
* @param <T>
* Type of number. Ex.: Double, Integer, Float, etc.
*
*
* @author inaiat
*/
public class AreaFillData<T extends Number> extends
Expand All @@ -47,43 +47,46 @@ public AreaFillData() {

/**
* Instantiates a new area fill data.
*
*
* @param values
* the values
*/
public AreaFillData(List<T>... values) {
for (int i = 0; i < values.length; i++) {
List<T> list = values[i];
addValue(list);
}
for (int i = 0; i < values.length; i++) {
List<T> list = values[i];
addValue(list);
}
}

/*
* (non-Javadoc)
*
*
* @see br.com.digilabs.jqplot.data.ChartData#getData()
*/
@Override
public Collection<List<T>> getData() {
return data;
return data;
}

/**
* Gets the size of the data.
*
* @return the data
*/
@Override
public int size()
{
return data.size();
}

/*
* (non-Javadoc)
*
*
* @see br.com.digilabs.jqplot.data.ChartData#toJsonString()
*/
@Override
public String toJsonString() {
JSONArray jsonArray = new JSONArray(data);
return jsonArray.toString();
JSONArray jsonArray = new JSONArray(data);
return jsonArray.toString();
}
}
21 changes: 12 additions & 9 deletions src/main/java/br/com/digilabs/jqplot/data/BarData.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Inaiat H. Moraes.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -19,7 +19,7 @@
import java.util.ArrayList;
import java.util.Collection;

import org.json.JSONArray;
import com.github.openjson.JSONArray;


/**
Expand All @@ -29,7 +29,7 @@
* @author inaiat
*/
public class BarData<T extends Number> extends AbstractCollectionData<Collection<T>> {

/** The Constant serialVersionUID. */
private static final long serialVersionUID = -2087356275172825289L;

Expand All @@ -41,19 +41,20 @@ public class BarData<T extends Number> extends AbstractCollectionData<Collection
*/
public BarData() {
}

/**
* Instantiates a new bar data.
*
* @param values the values
*/
public BarData(Collection<T>... values) {
addValues(values);
}
}

/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#getData()
*/
@Override
public Collection<Collection<T>> getData() {
return data;
}
Expand All @@ -63,6 +64,7 @@ public Collection<Collection<T>> getData() {
*
* @return the data
*/
@Override
public int size()
{
int ret = 0;
Expand All @@ -78,10 +80,11 @@ public int size()
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#toJsonString()
*/
@Override
public String toJsonString() {
JSONArray jsonArray = new JSONArray(data);
return jsonArray.toString();
}
}



}
16 changes: 10 additions & 6 deletions src/main/java/br/com/digilabs/jqplot/data/BubbleData.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Inaiat H. Moraes.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -16,11 +16,12 @@
*/
package br.com.digilabs.jqplot.data;

import br.com.digilabs.jqplot.data.item.BubbleItem;

import java.util.ArrayList;
import java.util.Collection;
import org.json.JSONArray;

import com.github.openjson.JSONArray;

import br.com.digilabs.jqplot.data.item.BubbleItem;

/**
* Data Helper to build Bubble Charts.
Expand All @@ -39,6 +40,7 @@ public class BubbleData<T extends BubbleItem> extends AbstractCollectionData<T>
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#getData()
*/
@Override
public Collection<T> getData() {
return data;
}
Expand All @@ -48,6 +50,7 @@ public Collection<T> getData() {
*
* @return the data
*/
@Override
public int size()
{
return data.size();
Expand All @@ -56,6 +59,7 @@ public int size()
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#toJsonString()
*/
@Override
public String toJsonString() {
JSONArray outerArray = new JSONArray();
JSONArray jsonArray = new JSONArray();
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/br/com/digilabs/jqplot/data/LabeledData.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Inaiat H. Moraes.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -16,13 +16,13 @@
*/
package br.com.digilabs.jqplot.data;

import br.com.digilabs.jqplot.data.item.LabeledItem;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.json.JSONArray;
import com.github.openjson.JSONArray;

import br.com.digilabs.jqplot.data.item.LabeledItem;

/**
* Data Helper to build Labeled Charts.
Expand Down Expand Up @@ -56,8 +56,9 @@ public LabeledData(LabeledItem<T>... values) {
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#toJsonString()
*/
@Override
public String toJsonString() {
JSONArray jsonArray = new JSONArray();
JSONArray jsonArray = new JSONArray();
for (LabeledItem<T> labeledItem : data) {
JSONArray itemArray = new JSONArray();
itemArray.put(labeledItem.getLabel());
Expand All @@ -72,6 +73,7 @@ public String toJsonString() {
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#getData()
*/
@Override
public Collection<LabeledItem<T>> getData() {
return data;
}
Expand All @@ -81,6 +83,7 @@ public Collection<LabeledItem<T>> getData() {
*
* @return the data
*/
@Override
public int size()
{
return data.size();
Expand Down
23 changes: 13 additions & 10 deletions src/main/java/br/com/digilabs/jqplot/data/LineSeriesData.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2011 Inaiat H. Moraes.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -20,7 +20,7 @@
import java.util.Collection;
import java.util.List;

import org.json.JSONArray;
import com.github.openjson.JSONArray;

import br.com.digilabs.jqplot.data.item.LineSeriesItem;

Expand All @@ -34,22 +34,24 @@ public class LineSeriesData<I extends Number,V extends Number> extends AbstractC

/** The Constant serialVersionUID. */
private static final long serialVersionUID = -8490476851004459871L;

/** The data. */
private List<Collection<LineSeriesItem<I, V>>> data = new ArrayList<Collection<LineSeriesItem<I, V>>>();

/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#getData()
*/
@Override
public Collection<Collection<LineSeriesItem<I, V>>> getData() {
return data;
}
}

/**
* Gets the size of the data.
*
* @return the data
*/
@Override
public int size()
{
int ret = 0;
Expand All @@ -64,8 +66,9 @@ public int size()
/* (non-Javadoc)
* @see br.com.digilabs.jqplot.data.ChartData#toJsonString()
*/
public String toJsonString() {
JSONArray jsonArray = new JSONArray();
@Override
public String toJsonString() {
JSONArray jsonArray = new JSONArray();
for (Collection<LineSeriesItem<I, V>> col : data) {
JSONArray serie = new JSONArray();
for (LineSeriesItem<I, V> lineSeriesItem : col) {
Expand All @@ -75,9 +78,9 @@ public String toJsonString() {
serie.put(itemArray);
}
jsonArray.put(serie);

}
return jsonArray.toString();
}

}
Loading