• 171阅读
  • 2回复

qt qchart柱状图坐标轴设置问题 [复制链接]

上一主题 下一主题
离线woshilicong
 

只看楼主 倒序阅读 楼主  发表于: 12-03
如何将红圈内的空间缩小,甚至没有
  


    QBarSet *set0 = new QBarSet("");  
QBarSet *set1 = new QBarSet("");  
QBarSet *set2 = new QBarSet("");    
QBarSet *set3 = new QBarSet("");    
QBarSet *set4 = new QBarSet("");    
QBarSet *set5 = new QBarSet("");    
QBarSet *set6 = new QBarSet("");  
QBarSet *set7 = new QBarSet("");    
QBarSet *set8 = new QBarSet("");  
  QBarSet *set9 = new QBarSet("");  
QBarSet *set10 = new QBarSet("");    
QBarSet *set11 = new QBarSet("");  
QBarSet *set12 = new QBarSet("");    
QBarSet *set13 = new QBarSet("");
    QBarSet *set14 = new QBarSet("");  
  QBarSet *set15 = new QBarSet("");    
QBarSet *set16 = new QBarSet("");  
QBarSet *set17 = new QBarSet("");  
QBarSet *set18 = new QBarSet("");  
  QBarSet *set19 = new QBarSet("");
   QBarSet *set20 = new QBarSet("");  
QBarSet *set21 = new QBarSet("");
   QBarSet *set22 = new QBarSet("");
    QBarSet *set23 = new QBarSet("");  
  QBarSet *set24 = new QBarSet("");    
QBarSet *set25 = new QBarSet("");    
QBarSet *set26 = new QBarSet("");    
QBarSet *set27 = new QBarSet("");

    *set0 << 1 ;    
*set1 << 5 ;    
*set2 << 3 ;    
*set3 << 5 ;    
*set4 << 9 ;    
*set5 << 9 ;  
*set6 << 9 ;  
*set7 << 9 ;  
*set8 << 9 ;  
*set9 << 9 ;  
*set10 << 9 ;  
*set11 << 9 ;  
*set12 << 9 ;    
*set13 << 9 ;
    *set14 << 1 ;  
  *set15 << 5 ;  
*set16 << 3 ;    
*set17 << 5 ;  
*set18 << 9 ;    
*set19 << 9 ;    
*set20 << 9 ;  
*set21 << 9 ;  
*set22 << 9 ;  
  *set23 << 9 ;    
*set24 << 9 ;  
*set25 << 9 ;  
*set26 << 9 ;  
*set27 << 9 ;

    QBarSeries *series = new QBarSeries();  
series->append(set0);    
series->append(set1);  
  series->append(set2);    
series->append(set3);  
  series->append(set4);    
series->append(set5);  
series->append(set6);  
  series->append(set7);  
series->append(set8);    
series->append(set9);  
series->append(set10);  
  series->append(set11);  
  series->append(set12);  
  series->append(set13);
    series->append(set14);  
  series->append(set15);  
series->append(set16);  
series->append(set17);  
series->append(set18);  
series->append(set19);  
series->append(set20);  
series->append(set21);    
series->append(set22);  
series->append(set23);  
  series->append(set24);    
series->append(set25);    
series->append(set26);  
series->append(set27);

    QChart *chart = new QChart();    
QChartView *chartView = new QChartView(chart);//    v.setRubberBand(QChartView::HorizontalRubberBand);  
  chartView->setRubberBand(QChartView::RectangleRubberBand);    
chart->addSeries(series);    

chart->setTitle("Simple barchart example");
  chart->setAnimationOptions(QChart::SeriesAnimations);  
chart->setTheme(QChart::ChartThemeBlueCerulean);  
  QStringList categories;    categories << "Jan" ;  
QBarCategoryAxis *axis = new QBarCategoryAxis();  
  axis->append(categories);  
axis->setGridLineVisible(false);    
chart->createDefaultAxes();    
chart->setAxisX(axis, series);
    chart->legend()->setVisible(false);  
  chart->legend()->setAlignment(Qt::AlignBottom);
//    QChartView *chartView = new QChartView(this);  
  ui->graphicsView->setChart(chart);  
ui->graphicsView->setRubberBand(QChartView::RectangleRubberBand);  
  ui->graphicsView->setRenderHint(QPainter::Antialiasing);
离线never_forget

只看该作者 1楼 发表于: 12-04
直接设置 Chart 控件的宽度 ?
离线青空飞羽

只看该作者 2楼 发表于: 12-04
貌似去不了,没看到QChart有类似接口
快速回复
限100 字节
 
上一个 下一个