我正在開發Android應用程序。在我的應用程序中,我必須顯示具有多種顏色的條形圖所以我使用了charts4j庫。我使用了以下鏈接charts4j example中的代碼。帶滾動條的多色條形圖
現在的問題是,只有當酒吧的數量超過屏幕,我才能顯示只有固定的酒吧,我無法滾動查看其餘bars.Here是我的屏幕截圖。 2
以下是我用來生成條形圖的代碼。
public static String getBarChartUrl()
{
BarChartPlot team1 = Plots.newBarChartPlot(Data.newData(25, 43, 12, 30,32,25, 43, 12, 30,32,25,25, 43, 12, 30,32,25), BLUEVIOLET, "Team A");
BarChartPlot team2 = Plots.newBarChartPlot(Data.newData(8, 35, 11, 5,9,25, 35, 11, 5,9,25,25, 43, 12, 30,32,25), ORANGERED, "Team B");
BarChartPlot team3 = Plots.newBarChartPlot(Data.newData(10, 20, 30, 30 ,15,32, 20, 30, 30 ,15,32,25, 43, 12, 30,32,25), LIMEGREEN, "Team C");
// Instantiating chart.
BarChart chart = GCharts.newBarChart(team1, team2, team3);
// Defining axis info and styles
AxisStyle axisStyle = AxisStyle.newAxisStyle(BLACK, 13, AxisTextAlignment.CENTER);
AxisLabels score = AxisLabelsFactory.newAxisLabels("Score", 50.0);
score.setAxisStyle(axisStyle);
AxisLabels year = AxisLabelsFactory.newAxisLabels("Year", 50.0);
year.setAxisStyle(axisStyle);
// Adding axis info to chart.
chart.addXAxisLabels(AxisLabelsFactory.newAxisLabels("2002", "2003", "2004", "2005","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017","2018"));
chart.addYAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, 100));
chart.addYAxisLabels(score);
chart.addXAxisLabels(year);
chart.setSize(600, 450);
chart.setBarWidth(50);
chart.setSpaceWithinGroupsOfBars(20);
chart.setDataStacked(true);
chart.setTitle("Team Scores", BLACK, 16);
chart.setGrid(100, 10, 3, 2);
chart.setBackgroundFill(Fills.newSolidFill(ALICEBLUE));
LinearGradientFill fill = Fills.newLinearGradientFill(0, LAVENDER, 100);
fill.addColorAndOffset(WHITE, 0);
chart.setAreaFill(fill);
String url = chart.toURLString();
return normalize(url);
}
我的問題是
1)按照數據的圖表必須顯示17條卻是露出8條只有[年份2002年至2018年,現在它最多顯示2009年僅]。如何我可以通過水平滾動查看剩餘的小節嗎?
2)如果條的數量是小於我可以查看標籤[代表哪個數據的每個顏色]。請具有低於圖像
一看如果數是更然後我不能查看標籤。看到第一個圖標。
3)我想知道有沒有什麼辦法給邊框單獨的背景顏色。我的意思是分數和年
請幫我找到一個解決方案
您指定的鏈接不工作 – amalBit
@amalBit ... sorry.now檢查鏈接 – sarath
您可以更改主要佈局成水平滾動視圖 – amalBit