This repository has been archived by the owner on Oct 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new SparklineGraph to Utils module and removed old sparklines l…
…ibrary. Moved TimeIntervalGraphics to Utils module.
- Loading branch information
Showing
13 changed files
with
658 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
build.xml.data.CRC32=93720211 | ||
build.xml.data.CRC32=febbff0b | ||
build.xml.script.CRC32=e39c7ed0 | ||
build.xml.stylesheet.CRC32=a56c6a5b@1.42.2 | ||
build.xml.stylesheet.CRC32=a56c6a5b@1.46.2 | ||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=93720211 | ||
nbproject/build-impl.xml.data.CRC32=febbff0b | ||
nbproject/build-impl.xml.script.CRC32=91e63bf0 | ||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2 | ||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- You may freely edit this file. See harness/README in the NetBeans platform --> | ||
<!-- for some information on what you could do (e.g. targets to override). --> | ||
<!-- If you delete this file and reopen the project it will be recreated. --> | ||
<project name="org.gephi.utils" default="netbeans" basedir="."> | ||
<description>Builds, tests, and runs the project org.gephi.utils.</description> | ||
<import file="nbproject/build-impl.xml"/> | ||
</project> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- You may freely edit this file. See harness/README in the NetBeans platform --> | ||
<!-- for some information on what you could do (e.g. targets to override). --> | ||
<!-- If you delete this file and reopen the project it will be recreated. --> | ||
<project name="org.gephi.utils" default="netbeans" basedir="."> | ||
<description>Builds, tests, and runs the project org.gephi.utils.</description> | ||
<import file="nbproject/build-impl.xml"/> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
*** GENERATED FROM project.xml - DO NOT EDIT *** | ||
*** EDIT ../build.xml INSTEAD *** | ||
--> | ||
<project name="org.gephi.utils-impl" basedir=".."> | ||
<fail message="Please build using Ant 1.7.1 or higher."> | ||
<condition> | ||
<not> | ||
<antversion atleast="1.7.1"/> | ||
</not> | ||
</condition> | ||
</fail> | ||
<property file="nbproject/private/suite-private.properties"/> | ||
<property file="nbproject/suite.properties"/> | ||
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> | ||
<property file="${suite.dir}/nbproject/private/platform-private.properties"/> | ||
<property file="${suite.dir}/nbproject/platform.properties"/> | ||
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> | ||
<attribute name="name"/> | ||
<attribute name="value"/> | ||
<sequential> | ||
<property name="@{name}" value="${@{value}}"/> | ||
</sequential> | ||
</macrodef> | ||
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> | ||
<attribute name="property"/> | ||
<attribute name="value"/> | ||
<sequential> | ||
<property name="@{property}" value="@{value}"/> | ||
</sequential> | ||
</macrodef> | ||
<property file="${user.properties.file}"/> | ||
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> | ||
<condition> | ||
<not> | ||
<contains string="${cluster.path.evaluated}" substring="platform"/> | ||
</not> | ||
</condition> | ||
</fail> | ||
<import file="${harness.dir}/build.xml"/> | ||
</project> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
*** GENERATED FROM project.xml - DO NOT EDIT *** | ||
*** EDIT ../build.xml INSTEAD *** | ||
--> | ||
<project name="org.gephi.utils-impl" basedir=".."> | ||
<fail message="Please build using Ant 1.7.1 or higher."> | ||
<condition> | ||
<not> | ||
<antversion atleast="1.7.1"/> | ||
</not> | ||
</condition> | ||
</fail> | ||
<property file="nbproject/private/suite-private.properties"/> | ||
<property file="nbproject/suite.properties"/> | ||
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail> | ||
<property file="${suite.dir}/nbproject/private/platform-private.properties"/> | ||
<property file="${suite.dir}/nbproject/platform.properties"/> | ||
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2"> | ||
<attribute name="name"/> | ||
<attribute name="value"/> | ||
<sequential> | ||
<property name="@{name}" value="${@{value}}"/> | ||
</sequential> | ||
</macrodef> | ||
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2"> | ||
<attribute name="property"/> | ||
<attribute name="value"/> | ||
<sequential> | ||
<property name="@{property}" value="@{value}"/> | ||
</sequential> | ||
</macrodef> | ||
<property file="${user.properties.file}"/> | ||
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/> | ||
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness)."> | ||
<condition> | ||
<not> | ||
<contains string="${cluster.path.evaluated}" substring="platform"/> | ||
</not> | ||
</condition> | ||
</fail> | ||
<import file="${harness.dir}/build.xml"/> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
build.xml.data.CRC32=25bb282d | ||
build.xml.data.CRC32=8befa235 | ||
build.xml.script.CRC32=1ccc572b | ||
build.xml.stylesheet.CRC32=a56c6a5b@1.42.2 | ||
build.xml.stylesheet.CRC32=a56c6a5b@1.46.2 | ||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | ||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | ||
nbproject/build-impl.xml.data.CRC32=25bb282d | ||
nbproject/build-impl.xml.data.CRC32=8befa235 | ||
nbproject/build-impl.xml.script.CRC32=495599b5 | ||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.42.2 | ||
nbproject/build-impl.xml.stylesheet.CRC32=238281d1@1.46.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
Utils/src/org/gephi/utils/sparklines/SparklineComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
Copyright 2008-2011 Gephi | ||
Authors : Eduardo Ramos <[email protected]> | ||
Website : http://www.gephi.org | ||
This file is part of Gephi. | ||
Gephi is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
Gephi is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with Gephi. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.gephi.utils.sparklines; | ||
|
||
import java.awt.Graphics; | ||
import java.awt.event.MouseAdapter; | ||
import java.awt.event.MouseEvent; | ||
import java.awt.event.MouseMotionListener; | ||
import java.awt.image.BufferedImage; | ||
import javax.swing.JComponent; | ||
|
||
/** | ||
* <p>Simple component that holds a <code>SparklineGraph</code> and auto-repaints it when mouse interaction happens if desired | ||
* (indicate it with <code>updateMouseXPosition</code> parameter in constructors).</p> | ||
* <p>It also takes care to update sparkline width and height to the component width and height when resized</p> | ||
* @author Eduardo Ramos <[email protected]> | ||
*/ | ||
public class SparklineComponent extends JComponent { | ||
|
||
private Number[] xValues, yValues; | ||
private Number yMinValue, yMaxValue; | ||
private SparklineParameters sparklineParameters; | ||
|
||
public SparklineComponent(Number[] yValues, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { | ||
this(null, yValues, null, null, sparklineParameters, updateMouseXPosition); | ||
} | ||
|
||
public SparklineComponent(Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { | ||
this(null, yValues, yMinValue, yMaxValue, sparklineParameters, updateMouseXPosition); | ||
} | ||
|
||
public SparklineComponent(Number[] xValues, Number[] yValues, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { | ||
this(xValues, yValues, null, null, sparklineParameters, updateMouseXPosition); | ||
} | ||
|
||
public SparklineComponent(Number[] xValues, Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters sparklineParameters, boolean updateMouseXPosition) { | ||
this.xValues = xValues; | ||
this.yValues = yValues; | ||
this.yMinValue = yMinValue; | ||
this.yMaxValue = yMaxValue; | ||
this.sparklineParameters = sparklineParameters; | ||
if (updateMouseXPosition) { | ||
initEvents(); | ||
} | ||
} | ||
|
||
private void initEvents() { | ||
MouseEvents listener = new MouseEvents(); | ||
addMouseListener(listener); | ||
addMouseMotionListener(listener); | ||
} | ||
|
||
@Override | ||
protected void paintComponent(Graphics g) { | ||
sparklineParameters.setWidth(getWidth()); | ||
sparklineParameters.setHeight(getHeight()); | ||
BufferedImage image = SparklineGraph.draw(xValues, yValues, yMinValue, yMaxValue, sparklineParameters); | ||
g.drawImage(image, 0, 0, this); | ||
} | ||
|
||
class MouseEvents extends MouseAdapter implements MouseMotionListener { | ||
|
||
@Override | ||
public void mouseEntered(MouseEvent e) { | ||
sparklineParameters.setHiglightedValueXPosition(e.getX()); | ||
repaint(); | ||
} | ||
|
||
@Override | ||
public void mouseExited(MouseEvent e) { | ||
sparklineParameters.setHiglightedValueXPosition(null); | ||
repaint(); | ||
} | ||
|
||
@Override | ||
public void mouseMoved(MouseEvent e) { | ||
sparklineParameters.setHiglightedValueXPosition(e.getX()); | ||
repaint(); | ||
} | ||
} | ||
} |
Oops, something went wrong.