发布时间:2025-12-09 11:58:41 浏览次数:1
import prefuse.action.ActionList; //导入依赖的package包/类/** * Updates the layout bounds of the specified instance visualization to the specified bounds, * allowing the visualization to be rendered at a higher/lower resolution. * * @param instanceVis * the instance visualization that will have its layout bounds changed * @param newLayoutBounds * the new layout bounds */public static void updateLayoutBounds( Visualization instanceVis, Rectangle2D newLayoutBounds ){ActionList axisList = (ActionList)instanceVis.getAction( "axis" );AxisLayout axisX = (AxisLayout)axisList.get( 0 );AxisLayout axisY = (AxisLayout)axisList.get( 1 );axisX.setLayoutBounds( newLayoutBounds );axisY.setLayoutBounds( newLayoutBounds );if ( axisList.size() > 2 ) {// Has labels as well.AxisLabelLayout labelX = (AxisLabelLayout)axisList.get( 2 );AxisLabelLayout labelY = (AxisLabelLayout)axisList.get( 3 );labelX.setLayoutBounds( newLayoutBounds );labelY.setLayoutBounds( newLayoutBounds );}} import prefuse.action.ActionList; //导入依赖的package包/类private ActionList createColorizeActions( Color color ){ActionList list = new ActionList();list.add(new ColorAction(DATA_ID,VisualItem.FILLCOLOR, color.getRGB()));list.add(new ColorAction(DATA_ID,VisualItem.STROKECOLOR, color.darker().getRGB()));return list;} import prefuse.action.ActionList; //导入依赖的package包/类public TimeOverviewView(JRangeSlider time_window_slider) {super(new Visualization());this.time_window_slider = time_window_slider;time_window_slider.addChangeListener(this);// save the reference to global datathis.d = Data.getData();eth = new FastEdgeTimeHistogram(d); ActionList draw = new ActionList(ActionList.INFINITY,200); draw.add(new RepaintAction()); m_vis.putAction("draw", draw); // TODO: this might have a locking issue m_vis.run("draw");} import prefuse.action.ActionList; //导入依赖的package包/类public static void updateInstanceVisualizationColors( HVConfig config, Visualization vis ){ColorAction colorize = createInstanceVisualizationColorAction( config );ActionList draw = (ActionList)vis.removeAction( "draw" );draw.remove( 1 ).cancel();draw.add( 1, colorize );vis.putAction( "draw", draw );} import prefuse.action.ActionList; //导入依赖的package包/类/** * @param histoTable * a histogrammized version of dataTable * @param startingField * the name of the field (column) of the data table * whose histogram is to be shown in the histogram graph. */public HistogramGraph( HistogramTable histoTable, String startingField, Color histogramColor ){super( new Visualization() );m_histoTable = histoTable;startingField = getStartingField( startingField );// --------------------------------------------------------------------// STEP 1: setup the visualized datam_vis.addTable( DATA_ID, m_histoTable );initializeRenderer();// --------------------------------------------------------------------// STEP 2: create actions to process the visual dataActionList colors = createColorizeActions( histogramColor );m_vis.putAction( "color", colors );ActionList draw = new ActionList();draw.add( initializeAxes( startingField ) );draw.add( colors );draw.add( new RepaintAction() );m_vis.putAction( "draw", draw );// --------------------------------------------------------------------// STEP 3: set up a display and ui components to show the visualizationinitializeWindowCharacteristics();// --------------------------------------------------------------------// STEP 4: launching the visualizationm_vis.run( "draw" );}