當前位置: 首頁>>代碼示例>>Java>>正文


Java DataShapeAction類代碼示例

本文整理匯總了Java中prefuse.action.assignment.DataShapeAction的典型用法代碼示例。如果您正苦於以下問題:Java DataShapeAction類的具體用法?Java DataShapeAction怎麽用?Java DataShapeAction使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataShapeAction類屬於prefuse.action.assignment包,在下文中一共展示了DataShapeAction類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createVisualizationV2

import prefuse.action.assignment.DataShapeAction; //導入依賴的package包/類
/**
 * Phase 2 from the example http://www.ifs.tuwien.ac.at/~rind/w/doku.php/java/prefuse-scatterplot without tooltip control
 * 
 * @param data
 * @return
 */

private View createVisualizationV2(Table data)
{
	final Visualization vis = new Visualization();
	PDisplay display = new PDisplay(this, vis);

	// STEP 1: setup the visualized data

	vis.add("data", data);

	/* STEP 2: set up renderers for the visual data */

	vis.setRendererFactory(new DefaultRendererFactory(new ShapeRenderer(12)));

	// STEP 3: create actions to process the visual data

	AxisLayout x_axis = new AxisLayout("data", "NBZ", Constants.X_AXIS, VisiblePredicate.TRUE);

	AxisLayout y_axis = new AxisLayout("data", "BMI", Constants.Y_AXIS, VisiblePredicate.TRUE);

	ColorAction color = new ColorAction("data", VisualItem.STROKECOLOR, ColorLib.rgb(100, 100, 255));

	int[] palette =
	{ Constants.SHAPE_STAR, Constants.SHAPE_ELLIPSE };
	DataShapeAction shape = new DataShapeAction("data", "Insult", palette);

	ActionList draw = new ActionList();
	draw.add(x_axis);
	draw.add(y_axis);
	draw.add(color);
	draw.add(shape);
	draw.add(new RepaintAction());
	vis.putAction("draw", draw);

	// --------------------------------------------------------------------
	// STEP 4: set up a display and controls
	display.setHighQuality(true);
	display.setSize(700, 450);

	// display.setBorder(BorderFactory.createEmptyBorder(15, 30, 15, 30));
	// // TODO for Dritan: setBorder method was in JComponent. See if there
	// is a similar method in Android.View
	display.setBorders(15, 30, 15, 30);

	// STEP 5: launching the visualization. The visualization must run after
	// the Display is ready (Android View)
	// TODO for Dritan: using dispay.post seems to be not a good solution.
	// Fix this before releasing the final solution
	display.post(new Runnable()
	{
		@Override
		public void run()
		{
			vis.run("draw");
		}
	});

	return display;
}
 
開發者ID:dritanlatifi,項目名稱:AndroidPrefuse,代碼行數:66,代碼來源:MainActivityOld.java


注:本文中的prefuse.action.assignment.DataShapeAction類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。