public class SelectionAttributes
extends java.lang.Object
By accessing this class you can enable/disable selection, as well as set the Selection Mode. It is accessed in the chart via the Selection method.
Constructor and Description |
---|
SelectionAttributes() |
Modifier and Type | Method and Description |
---|---|
void |
addSelectionChangedListener(EventListener value)
Adds a SelectionChangedListener to the listener list.
|
void |
clearSelection()
Clears the Selected Points and Series.
|
PointAttributes |
getAttributes()
Gets or sets the PointAttributes object for the selected element.
|
HitType |
getHitType()
Description goes here
|
java.util.List<java.lang.Integer> |
getMultipleSelectedPoint()
Gets a list of the selected points
|
java.util.List<java.lang.Integer> |
getMultipleSelectedSeries()
Gets a list of the selected series
|
int |
getSelectedPoint()
Gets the selected point
|
int |
getSelectedSeries()
Gets the selected series
|
boolean |
isAllowMultiple()
Gets or sets a Boolean that determines whether or not Multiple Points Selection is enabled on the chart.
|
boolean |
isEnabled()
Gets or sets a Boolean that determines whether or not Selection is enabled on the chart.
|
boolean |
isSelectSeries()
Allows you to specify if the user selection will be reflected in all series.
|
void |
removeSelectionChangedListener(EventListener value)
Removes a SelectionChangedListener from the listener list.
|
void |
resetAllowMultiple()
Set the property AllowMultiple to its default value.
|
void |
resetEnabled()
Set the property Enabled to its default value.
|
void |
resetSelectedPoint()
Set the property SelectedPoint to its default value.
|
void |
resetSelectedSeries()
Set the property SelectedSeries to its default value.
|
void |
resetSelectSeries()
Set the property SelectSeries to its default value.
|
boolean |
select(int series,
int point)
Allows adding Datapoints and Series to Selection Lists
|
void |
setAllowMultiple(boolean value)
Gets or sets a Boolean that determines whether or not Multiple Points Selection is enabled on the chart.
|
void |
setEnabled(boolean value)
Gets or sets a Boolean that determines whether or not Selection is enabled on the chart.
|
void |
setSelectSeries(boolean value)
Allows you to specify if the user selection will be reflected in all series.
|
public boolean isAllowMultiple()
chart1.getSelection().setAllowMultiple(true);
resetAllowMultiple
public void setAllowMultiple(boolean value)
chart1.getSelection().setAllowMultiple(true);
value
- resetAllowMultiple
public PointAttributes getAttributes()
chart1.getSelection().getAttributes().setColor(new java.awt.Color(0,0,0,255)); chart1.getSelection().getAttributes().setFillMode(FillMode.SOLID);
public boolean isEnabled()
chart1.getSelection().setEnabled(true);
resetEnabled
public void setEnabled(boolean value)
chart1.getSelection().setEnabled(true);
value
- resetEnabled
public HitType getHitType()
public java.util.List<java.lang.Integer> getMultipleSelectedPoint()
public java.util.List<java.lang.Integer> getMultipleSelectedSeries()
public boolean isSelectSeries()
Allows you to specify if the user selection will be reflected in all series.
setSelection
on the chart must be enabled.Below, if the third point is selected (March) when SelectSeries is set to true, only the point in the specified series will be selected:
PopulateCarProduction(chart1);
chart1.getTitles().add(new TitleDockable("Vehicles Production by Type"));
chart1.setGallery(Gallery.BAR);
chart1.getLegendBox().setDock(DockArea.BOTTOM);
chart1.getLegendBox().setContentLayout(ContentLayout.CENTER);
chart1.getSelection().setEnabled(true);
chart1.getSelection().setSelectSeries(true);
chart1.getSelection().select(0, 2);
chart1.getSelection().getAttributes().setColor(new java.awt.Color(255,165,0,255));
public static void PopulateCarProduction(Chart chart1) { CarProduction[] production = new CarProduction[] { new CarProduction("Jan", 1760, 535, 695 ) , new CarProduction("Feb", 1849, 395, 688 ) , new CarProduction("Mar", 2831, 685, 1047 ) , new CarProduction("Apr", 2851, 984, 1652 ) , new CarProduction("May", 2961, 1579, 1889 ) , new CarProduction("Jun", 1519, 1539, 1766 ) , new CarProduction("Jul", 2633, 1489, 1361 ) , new CarProduction("Aug", 1140, 650, 874 ) , new CarProduction("Sep", 1626, 653, 693 ) , new CarProduction("Oct", 1478, 2236, 786 ) , new CarProduction("Nov", 1306, 1937, 599 ) , new CarProduction("Dec", 1607, 2138, 678 ) }; ObjectProvider objProvider = new ObjectProvider(production); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class CarProduction { private CarProduction(String month, int sedan, int coupe, int SUV) { this.setMonth(month); this.setSedan(sedan); this.setCoupe(coupe); this.setSUV(SUV); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private int privateSedan; public final int getSedan() { return privateSedan; } public final void setSedan(int value) { privateSedan = value; } private int privateCoupe; public final int getCoupe() { return privateCoupe; } public final void setCoupe(int value) { privateCoupe = value; } private int privateSUV; public final int getSUV() { return privateSUV; } public final void setSUV(int value) { privateSUV = value; } }
On the other hand, if SelectSeries is set to false, the third point will be selected in all series:
PopulateCarProduction(chart1);
chart1.getTitles().add(new TitleDockable("Vehicles Production by Type"));
chart1.setGallery(Gallery.BAR);
chart1.getLegendBox().setDock(DockArea.BOTTOM);
chart1.getLegendBox().setContentLayout(ContentLayout.CENTER);
chart1.getSelection().setEnabled(true);
chart1.getSelection().setSelectSeries(false);
chart1.getSelection().select(0, 2);
chart1.getSelection().getAttributes().setColor(new java.awt.Color(255,165,0,255));
public static void PopulateCarProduction(Chart chart1) { CarProduction[] production = new CarProduction[] { new CarProduction("Jan", 1760, 535, 695 ) , new CarProduction("Feb", 1849, 395, 688 ) , new CarProduction("Mar", 2831, 685, 1047 ) , new CarProduction("Apr", 2851, 984, 1652 ) , new CarProduction("May", 2961, 1579, 1889 ) , new CarProduction("Jun", 1519, 1539, 1766 ) , new CarProduction("Jul", 2633, 1489, 1361 ) , new CarProduction("Aug", 1140, 650, 874 ) , new CarProduction("Sep", 1626, 653, 693 ) , new CarProduction("Oct", 1478, 2236, 786 ) , new CarProduction("Nov", 1306, 1937, 599 ) , new CarProduction("Dec", 1607, 2138, 678 ) }; ObjectProvider objProvider = new ObjectProvider(production); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class CarProduction { private CarProduction(String month, int sedan, int coupe, int SUV) { this.setMonth(month); this.setSedan(sedan); this.setCoupe(coupe); this.setSUV(SUV); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private int privateSedan; public final int getSedan() { return privateSedan; } public final void setSedan(int value) { privateSedan = value; } private int privateCoupe; public final int getCoupe() { return privateCoupe; } public final void setCoupe(int value) { privateCoupe = value; } private int privateSUV; public final int getSUV() { return privateSUV; } public final void setSUV(int value) { privateSUV = value; } }
resetSelectSeries
public void setSelectSeries(boolean value)
Allows you to specify if the user selection will be reflected in all series.
setSelection
on the chart must be enabled.Below, if the third point is selected (March) when SelectSeries is set to true, only the point in the specified series will be selected:
PopulateCarProduction(chart1);
chart1.getTitles().add(new TitleDockable("Vehicles Production by Type"));
chart1.setGallery(Gallery.BAR);
chart1.getLegendBox().setDock(DockArea.BOTTOM);
chart1.getLegendBox().setContentLayout(ContentLayout.CENTER);
chart1.getSelection().setEnabled(true);
chart1.getSelection().setSelectSeries(true);
chart1.getSelection().select(0, 2);
chart1.getSelection().getAttributes().setColor(new java.awt.Color(255,165,0,255));
public static void PopulateCarProduction(Chart chart1) { CarProduction[] production = new CarProduction[] { new CarProduction("Jan", 1760, 535, 695 ) , new CarProduction("Feb", 1849, 395, 688 ) , new CarProduction("Mar", 2831, 685, 1047 ) , new CarProduction("Apr", 2851, 984, 1652 ) , new CarProduction("May", 2961, 1579, 1889 ) , new CarProduction("Jun", 1519, 1539, 1766 ) , new CarProduction("Jul", 2633, 1489, 1361 ) , new CarProduction("Aug", 1140, 650, 874 ) , new CarProduction("Sep", 1626, 653, 693 ) , new CarProduction("Oct", 1478, 2236, 786 ) , new CarProduction("Nov", 1306, 1937, 599 ) , new CarProduction("Dec", 1607, 2138, 678 ) }; ObjectProvider objProvider = new ObjectProvider(production); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class CarProduction { private CarProduction(String month, int sedan, int coupe, int SUV) { this.setMonth(month); this.setSedan(sedan); this.setCoupe(coupe); this.setSUV(SUV); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private int privateSedan; public final int getSedan() { return privateSedan; } public final void setSedan(int value) { privateSedan = value; } private int privateCoupe; public final int getCoupe() { return privateCoupe; } public final void setCoupe(int value) { privateCoupe = value; } private int privateSUV; public final int getSUV() { return privateSUV; } public final void setSUV(int value) { privateSUV = value; } }
On the other hand, if SelectSeries is set to false, the third point will be selected in all series:
PopulateCarProduction(chart1);
chart1.getTitles().add(new TitleDockable("Vehicles Production by Type"));
chart1.setGallery(Gallery.BAR);
chart1.getLegendBox().setDock(DockArea.BOTTOM);
chart1.getLegendBox().setContentLayout(ContentLayout.CENTER);
chart1.getSelection().setEnabled(true);
chart1.getSelection().setSelectSeries(false);
chart1.getSelection().select(0, 2);
chart1.getSelection().getAttributes().setColor(new java.awt.Color(255,165,0,255));
public static void PopulateCarProduction(Chart chart1) { CarProduction[] production = new CarProduction[] { new CarProduction("Jan", 1760, 535, 695 ) , new CarProduction("Feb", 1849, 395, 688 ) , new CarProduction("Mar", 2831, 685, 1047 ) , new CarProduction("Apr", 2851, 984, 1652 ) , new CarProduction("May", 2961, 1579, 1889 ) , new CarProduction("Jun", 1519, 1539, 1766 ) , new CarProduction("Jul", 2633, 1489, 1361 ) , new CarProduction("Aug", 1140, 650, 874 ) , new CarProduction("Sep", 1626, 653, 693 ) , new CarProduction("Oct", 1478, 2236, 786 ) , new CarProduction("Nov", 1306, 1937, 599 ) , new CarProduction("Dec", 1607, 2138, 678 ) }; ObjectProvider objProvider = new ObjectProvider(production); chart1.getDataSourceSettings().setDataSource(objProvider); }
public static class CarProduction { private CarProduction(String month, int sedan, int coupe, int SUV) { this.setMonth(month); this.setSedan(sedan); this.setCoupe(coupe); this.setSUV(SUV); } private String privateMonth; public final String getMonth() { return privateMonth; } public final void setMonth(String value) { privateMonth = value; } private int privateSedan; public final int getSedan() { return privateSedan; } public final void setSedan(int value) { privateSedan = value; } private int privateCoupe; public final int getCoupe() { return privateCoupe; } public final void setCoupe(int value) { privateCoupe = value; } private int privateSUV; public final int getSUV() { return privateSUV; } public final void setSUV(int value) { privateSUV = value; } }
value
- resetSelectSeries
public int getSelectedPoint()
Gets the selected point
If isAllowMultiple
method is set to true, the SelectedPoint value will be the last point selected.
To get the current selected point:
int spoint; spoint = chart1.getSelection().getSelectedPoint();
resetSelectedPoint
public int getSelectedSeries()
Gets the selected series
If isAllowMultiple
method is set to true, the SelectedSeries value will be the last series selected.
To get the current selected series:
int sseries; sseries = chart1.getSelection().getSelectedSeries();
resetSelectedSeries
public void clearSelection()
After the method is called, the selected points and series List will be empty.
To clear all previously selected items:
chart1.getSelection().ClearSelection();
public void resetAllowMultiple()
isAllowMultiple
public void resetEnabled()
isEnabled
public void resetSelectSeries()
isSelectSeries
public void resetSelectedPoint()
setSelectedPoint
public void resetSelectedSeries()
setSelectedSeries
public boolean select(int series, int point)
Allows adding Datapoints and Series to Selection Lists
This method allows selecting Datapoints and Series on the chart.
The Selection must be enabled to use this method.
If AllowMultiple is set to true, more than one Datapoint can be selected and added to the MultipleSelectedPoint and MultipleSelectedSeries List.
To select a the 3rd point of the 2nd series only:
chart1.getSelection().setEnabled(true);
chart1.getSelection().setSelectSeries(true);
chart1.getSelection().select(1, 2);
series
- Is used to identify the point to select by the index positionpoint
- An integer specifying the series.public void addSelectionChangedListener(EventListener value)
value
- public void removeSelectionChangedListener(EventListener value)
value
- 2014 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
All other names are trademarks or registered trademarks of their respective owners.