2012-02-06 4 views
0

link으로 입력을 하드 코드하여 차트를 생성 할 수 있음을 보여줍니다. 이제 boys와 girls의 값을 설정하는 대신 데이터베이스에 쿼리하고 ACTIVE 상태로 요청 합계를 얻으 려합니다. 할 수는 있지만 여기에 제공된 차트에서 어떻게 모델링 할 수 있습니까?CartesianChartModel 데이터베이스 값

답변

0

그런 식 으로요? db 쿼리 로직을 직접 추가해야합니다 ...

private void createCategoryModel() { 
    categoryModel = new CartesianChartModel(); 

    ChartSeries active_chart = new ChartSeries(); 
    active_chart.setLabel("ACTIVE"); 

    int total = 250; 
    int active = 100; 
    int non_active = total - active; 

    active_chart.set("Bar_Lablel", active); 


    ChartSeries non_active_chart = new ChartSeries(); 
    non_active_chart.setLabel("NON ACTIVE "); 

    non_active_chart.set("Bar_Lablel", non_active); 


    categoryModel.addSeries(active_chart); 
    categoryModel.addSeries(non_active_chart); 
} 
관련 문제