public JScrollBar hbar=null
public JScrollBar vbar=null
public void addScrollBar(int value,int width,int min,int max,int which){
if(which==100&&hbar==null)
{
hbar =new JScrollBar(JScrollBar.VERTICAL, value,width,min,max)
panelThree.add(hbar,"East")
hbar.addAdjustmentListener(new MyAdjustmentListener(this))
}
else if(which==200&&vbar==null)
{
vbar =new JScrollBar(JScrollBar.HORIZONTAL,value,width,min,max)
panelThree.add(vbar,"South")
vbar.addAdjustmentListener(new MyAdjustmentListener(this))
}
else if(which==100&&hbar!=null){
hbar.setValues(value, width, min, max)
panelThree.add(hbar,"East")
hbar.setVisible(true)
}
else if(which==200&&vbar!=null){
vbar.setValues(value, width, min, max)
vbar.setVisible(true)
}
int w=this.getWidth()
int h=this.getHeight()
this.setSize(w, h-5)
this.setSize(w, h)
}
TDBChart也可以吧.procedure TForm_SJFX_XSFX.ShowChart(itype: integer Dset: TQuery xlabel,
yvalues: string)
var
vPie: TPieSeries
vBar: TBarSeries
vLine: TLineSeries
i: integer
begin
isMannul := false
while DBChart.SeriesCount > 0 do DBChart.SeriesList[0].Destroy
DBChart.Title.Text.Clear
DBChart.Title.Text.Add(ChartTitle)
DBChart.LeftAxis.Title.Caption := yvalues
DBChart.BottomAxis.Title.Caption := xlabel
//
if itype = 0 then
begin
vBar := TBarSeries.Create(nil)
vBar.ParentChart := DBChart
vBar.DataSource := Dset
vBar.YValues.ValueSource := yvalues
vBar.XLabelsSource := xlabel
vBar.Marks.Style := smsValue
DBChart.AddSeries(vBar)
end
else if itype = 2 then
begin
vPie := TPieSeries.Create(nil)
vPie.ParentChart := DBChart
vPie.DataSource := Dset
vPie.YValues.ValueSource := yvalues
vPie.XLabelsSource := xlabel
vPie.Marks.Style := smsLabelPercent
DBChart.AddSeries(vPie)
end
else
begin
vLine := TLineSeries.Create(nil)
vLine.ParentChart := DBChart
vLine.DataSource := Dset
vLine.YValues.ValueSource := yvalues
vLine.XLabelsSource := xlabel
vLine.Marks.Style := smsLabelPercent
DBChart.AddSeries(vLine)
end
end
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)