1 Son düzenleyen, cetinbasoz (09.09.2008 12:05:46)

Konu: Grafik - ornek

Baska bir nedenle elimden geciyordu buraya atayim dedim, hem sessizligi biaz bozmus olayim:)

Visual Fox Pro
*#INCLUDE "mschrt20.h"

#Define VtChChartType3dBar                                0
#Define VtChChartType2dBar                                1
 
#Define VtChLabelComponentValue    1    && The value of the data point appears in the label.
#Define VtChLabelComponentPercent    2    && The value of the data point is displayed in the label as a percentage of the total value of the series.
 
#Define VtOrientationHorizontal    0    && Horizontal text
#Define VtOrientationVertical    1    && Vertical text
#Define VtOrientationUp    2    && Up oriented text
#Define VtOrientationDown    3    && Down oriented text
 
#Define VtChLabelLocationTypeNone    0    && Label Location - None
#Define VtChLabelLocationTypeAbovePoint    1    && Label Location - AbovePoint
#Define VtChLabelLocationTypeBelowPoint    2    && Label Location - BelowPoint
#Define VtChLabelLocationTypeCenter    3    && Label Location - Center
#Define VtChLabelLocationTypeBase    4    && Label Location - Base
#Define VtChLabelLocationTypeInside    5    && Label Location - Inside pie or doughnut
#Define VtChLabelLocationTypeOutside    6    && Label Location - Outside pie or doughnut
#Define VtChLabelLocationTypeLeft    7    && Label Location - Left
#Define VtChLabelLocationTypeRight    8    && Label Location - Right
 
Public loCharter
loCharter = Createobject('myCharter')
loCharter.Show
 
Define Class myCharter As Form
  DataSession = 2
  Height = 600
  Width = 800
  Add Object myGrid As Grid With ;
    left=10,Top=10,Height=580,Width=360,Anchor=1+2+4+128
  Add Object Chart As OleControl With ;
    left=375,Top=10,Height=580,Width=415,Anchor=1+8+4+32, ;
    OleClass="MSChart20Lib.MSChart.2"
 
  Procedure Load
    Use (_samples+'data\Customer')
  Endproc
 
  Procedure Init
    This.UpdateChart()
  Endproc
 
  Procedure myGrid.AfterRowColChange
    Lparameters nColIndex
    * VFP7 and up - earlier no if control
    If This.RowColChange%2 = 1
      Thisform.UpdateChart()
    Endif
  Endproc
 
  Procedure UpdateChart
    Select ;
      emp.First_Name - (' '+emp.Last_Name) As employee,;
      sum(order_net) As totalSale ;
      FROM (_samples+'data\orders') ord ;
      INNER Join (_samples+'data\employee') emp On emp.emp_id = ord.emp_id ;
      WHERE ord.cust_id == customer.cust_id ;
      GROUP By 1 ;
      ORDER By 1 ;
      INTO Cursor crsChartData
    If _Tally > 0
      With Thisform.Chart
        .ChartType = VtChChartType2dBar && VtChChartType2dBar
        rowLabelCount = 1
        rowCount = Reccount()
        columnLabelCount = 0
        ColumnCount = 1
        .DataGrid.SetSize(m.rowLabelCount, m.columnLabelCount, ;
          m.rowCount, m.ColumnCount )
 
        .Column = 1
        Scan
          .Row = Recno()
          .Data = totalSale
          .DataGrid.RowLabel(Recno(),1) = employee
        Endscan
 
        For Each serX In .Plot.SeriesCollection
          With serX.Datapoints.Item(-1).DatapointLabel
            .Component = VtChLabelComponentValue  && Show value
            .LocationType = VtChLabelLocationTypeAbovePoint && Above
            .ValueFormat = '$#,##0.00'
          Endwith
        Endfor
        .Visible = .T.
      Endwith
    Else
      Thisform.Chart.Visible = .F.
    Endif
  Endproc
Enddefine

2

Re: Grafik - ornek

Evet ya son gunlerde epey sessiz kaldik smile bende yeni yeni pc basinda fazlaca vakit gecirebilmeye basladim disardaki isleri bitirip smile


bu arada ornek cok guzel ellerine saglik , tesekkurler...

3

Re: Grafik - ornek

çetin bey bu örneğinizi kullanarak bir formda grafik denemesi yapmaya çalıştım
forma mschart ekledim ve bir butonun click ine aşağıdaki gibi kod yazdım

Visual Fox Pro
With Thisform.Chart

      .ChartType = 1 &&VtChChartType2dBar
      rowLabelCount = 1
      rowCount = Reccount()
      columnLabelCount = 0
      ColumnCount = 1
      .DataGrid.SetSize(m.rowLabelCount, m.columnLabelCount, ;
        m.rowCount, m.ColumnCount )
      .Column = 1
      .visible = .t.
      Scan
        .Row = Recno()
        .Data = pres  &&totalSale
        .DataGrid.RowLabel(Recno(),1) = aylar &&employee
        *.titletext = "AYLIK ÜRETİM MİKTARLARI"
 
      ENDSCAN
 
      For Each serX In .Plot.SeriesCollection
        With serX.Datapoints.Item(-1).DatapointLabel
          .Component = 1&& Show value
          .LocationType = 1 && Above
           .ValueFormat = '###.###'
 
        Endwith
      Endfor
    Endwith


sizin procedur updatechart  ' ın aynısı yani
1- y exsenindeki değerlerin formatını nasıl ayarlayabilirim
0
5.000.000
10.000.000
....
50.000.000 olacak şekilde sıralamak istiyorum
maksimum scale , minumum scale, division
bunları bir türlü ayarlayamadım birde sayıları 5E+006 , 1E+007,1.5+007 şeklinde gösteriyor
uğraştım ama birtürlü düzeltemedim,düzeltme için ne yapabilirim(foruma resim olarak ekleyecektim ama nasıl eklendiğini bulamadım)

Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

4

Re: Grafik - ornek

min ve max scale için aşağıdaki şekilde bir kullanım deneyebilirsin.

Visual Fox Pro
SELECT Grafikler

APPEND GENERAL puang CLASS MSGraph.Chart DATA lcData
WITH Thisform.OleBoundControl01 AS "MSGraph.Chart"
    .ControlSource = "grafikler.puang"
    .HasLegend = .t.
    .autoformat(-4100,1)
    .Axes(2).MinimumScale = 10
    .Axes(2).MaximumScale = 100
ENDWITH

5

Re: Grafik - ornek

özcan yazdıklarını denedim ama olmadı , ole control hatası veriyor
msgraph ile değil mschartla oluşuyor grafik

Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

6

Re: Grafik - ornek

Visual Fox Pro
#INCLUDE "mschrt20.h"

 
Public loCharter
loCharter = Createobject('myCharter')
loCharter.Show
 
Define Class myCharter As Form
  DataSession = 2
  Height = 600
  Width = 800
  Add Object myGrid As Grid With ;
    left=10,Top=10,Height=580,Width=360,Anchor=1+2+4+128
  Add Object Chart As OleControl With ;
    left=375,Top=10,Height=580,Width=415,Anchor=1+8+4+32, ;
    OleClass="MSChart20Lib.MSChart.2"
 
  Procedure Load
    Use (_samples+'data\Customer')
  Endproc
 
  Procedure Init
    This.UpdateChart()
  Endproc
 
  Procedure myGrid.AfterRowColChange
    Lparameters nColIndex
    * VFP7 and up - earlier no if control
    If This.RowColChange%2 = 1
      Thisform.UpdateChart()
    Endif
  Endproc
 
  Procedure UpdateChart
    Select ;
      emp.First_Name - (' '+emp.Last_Name) As employee,;
      sum(order_net*5000) As totalSale ;
      FROM (_samples+'data\orders') ord ;
      INNER Join (_samples+'data\employee') emp On emp.emp_id = ord.emp_id ;
      WHERE ord.cust_id == customer.cust_id ;
      GROUP By 1 ;
      ORDER By 1 ;
      INTO Cursor crsChartData
    If _Tally > 0
      With Thisform.Chart
        .ChartType = VtChChartType2dBar && VtChChartType2dBar
        rowLabelCount = 1
        rowCount = Reccount()
        columnLabelCount = 0
        ColumnCount = 1
        .DataGrid.SetSize(m.rowLabelCount, m.columnLabelCount, ;
          m.rowCount, m.ColumnCount )
 
        .Column = 1
        Scan
          .Row = Recno()
          .Data = totalSale
          .DataGrid.RowLabel(Recno(),1) = employee
        Endscan
 
        For Each serX In .Plot.SeriesCollection
          With serX.Datapoints.Item(-1).DatapointLabel
            .Component = VtChLabelComponentValue  && Show value
            .LocationType = VtChLabelLocationTypeAbovePoint && Above
            .ValueFormat = '$#,##0.00'
          Endwith
        Endfor
        For Each oLabel In .Plot.Axis(VtChAxisIdY).Labels
          oLabel.Format = '$#,##0.00'
        Endfor
        For Each oLabel In .Plot.Axis(VtChAxisIdY2).Labels
          oLabel.Format = '$#,##0.00'
        Endfor
        With .Plot.Axis(VtChAxisIdY).ValueScale
          .Auto = .F.
          .Minimum = 0
          .Maximum = 50000000
          .MajorDivision = 10 && 10 parca - 5 000 000
          .MinorDivision = 5 && 5 parca - 1 000 000
        Endwith
        With .Plot.Axis(VtChAxisIdY2).ValueScale
          .Auto = .F.
          .Minimum = 0
          .Maximum = 50000000
          .MajorDivision = 5 && 5 parca - 10 000 000
        Endwith
 
        .Visible = .T.
      Endwith
    Else
      Thisform.Chart.Visible = .F.
    Endif
  Endproc
Enddefine

MSChart dokumentasyonu var:

http://msdn.microsoft.com/en-us/library … S.71).aspx

7

Re: Grafik - ornek

çetin bey yazdıklarınız uyguladım ama halen sayıları 5E+006 , 1E+007,1.5+007  şeklinde gösteriyor . 6 haneli sayılarda problem yok 7 hane olunca problem oluyor sanki

[img]C:\Documents and Settings\user\Belgelerim\Resimlerim\grf2.jpeg[/img]

Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

8

Re: Grafik - ornek

Bende olmuyor. Bilmiyorum. Aynen o kodu calistirdim ben.

9

Re: Grafik - ornek

birde buna bakabilirmisiniz,acaba benim ayarlarımdamı bir problem var

Visual Fox Pro
#INCLUDE "mschrt20.h"

Public loCharter
loCharter = Createobject('myCharter')
loCharter.Show
 
Define Class myCharter As Form
  DataSession = 2
  Height = 600
  Width = 800
  Add Object myGrid As Grid With ;
    left=10,Top=10,Height=580,Width=360,Anchor=1+2+4+128
  Add Object Chart As OleControl With ;
    left=375,Top=10,Height=580,Width=415,Anchor=1+8+4+32, ;
    OleClass="MSChart20Lib.MSChart.2"
 
Procedure Load
 
CREATE CURSOR crsgrf  ( aylar c(20),miktar1 n(10),miktar2 n(10) )
INSERT INTO crsgrf VALUES ( "OCAK",28000000,6000000)
INSERT INTO crsgrf VALUES ( "ŞUBAT",33000000,12000000)
INSERT INTO crsgrf VALUES ( "MART",37000000,9000000)
INSERT INTO crsgrf VALUES ( "NİSAN",35000000,15000000)
INSERT INTO crsgrf VALUES ( "MAYIS",0,0)
INSERT INTO crsgrf VALUES ( "HAZİRAN",0,0)
INSERT INTO crsgrf VALUES ( "TEMMUZ",0,0)
INSERT INTO crsgrf VALUES ( "AĞUSTOS",0,0)
INSERT INTO crsgrf VALUES ( "EYLÜL",0,0)
INSERT INTO crsgrf VALUES ( "EKİM",0,0)
INSERT INTO crsgrf VALUES ( "KASIM",0,0)
INSERT INTO crsgrf VALUES ( "ARALIK",0,0)
Endproc
 
  Procedure Init
    This.UpdateChart()
  Endproc
 
   Procedure UpdateChart
 
      With Thisform.Chart
        .ChartType = 1 && VtChChartType2dBar
        rowLabelCount = 1
        rowCount = Reccount()
        columnLabelCount = 0
        ColumnCount = 1
        .DataGrid.SetSize(m.rowLabelCount, m.columnLabelCount, ;
          m.rowCount, m.ColumnCount )
         .Column = 1
        Scan
          .Row = Recno()
          .Data = miktar1
          .DataGrid.RowLabel(Recno(),1) = aylar
        Endscan
 
        For Each serX In .Plot.SeriesCollection
          With serX.Datapoints.Item(-1).DatapointLabel
            .Component = 1  && Show value
            .LocationType = 1 && Above
            .ValueFormat = '##.###.###'
          Endwith
        Endfor
        For Each oLabel In .Plot.Axis(miktar1).Labels
          oLabel.Format = '##.###.###'
        Endfor
 
        With .Plot.Axis(miktar1).ValueScale
          .Auto = .F.
          .Minimum = 0
          .Maximum = 50000000
          .MajorDivision = 5 && 10 parca - 5 000 000
          .MinorDivision = 2 && 5 parca - 1 000 000
        Endwith
     Endwith
      Thisform.Chart.Visible = .t.
  Endproc
Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

10

Re: Grafik - ornek

sonlardaki bölümü değiştirerek dener misin. Miktar1 yerine (1) kullanarak

Visual Fox Pro
For Each oLabel In .Plot.Axis(1).Labels

          oLabel.Format = '#.###.###.###'
        Endfor
        For Each oLabel In .Plot.Axis(2).Labels
          oLabel.Format = '#.###.###.###'
        Endfor

11

Re: Grafik - ornek

hay Allah razı olsun,kaç gündür evir çevir, tutturamadım bi türlü.
peki bu grafikte  miktar1 ve miktar 2 yi birlikte göstermek için ne yapabilirim

Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

12

Re: Grafik - ornek

For Each döngüsünden öncesini şöyle değiştirip deneyebilir misin.

Visual Fox Pro
ColumnCount = 2

        .DataGrid.SetSize(m.rowLabelCount, m.columnLabelCount, ;
          m.rowCount, m.ColumnCount )
         .Column = 1
        Scan
          .Row = Recno()
          .Data = miktar1
          .DataGrid.RowLabel(Recno(),1) = aylar
        Endscan
         .Column = 2
        Scan
          .Row = Recno()
          .Data = miktar2
          .DataGrid.RowLabel(Recno(),1) = aylar
        Endscan

13

Re: Grafik - ornek

özcan çok teşekkür ederim buda halloldu. son bişey daha sorayım, bunun çıktısını n asıl alacağız yani frx te rapor haline nasıl getireceğiz.

Kader, beyaz kağıda sütle yazılmış yazı
Elindeyse beyazdan, gel de sıyır beyazı. (NFK)

14

Re: Grafik - ornek

O kadar yazdim gonder diyince "yetkiniz yok" gibisinden bir mesajla yazdiklarim gitti @#!@$$.

http://windows-tech.info/9/4ec7cc4760082e8a.php

15

Re: Grafik - ornek

cetinbasoz yazdı:

O kadar yazdim gonder diyince "yetkiniz yok" gibisinden bir mesajla yazdiklarim gitti @#!@$$.

http://windows-tech.info/9/4ec7cc4760082e8a.php

ben bunu daha önce de defalarca Soykan'a söyledim ama malesef... Bir mesajı belli bir süre içinde yazmazsan kabul etmiyor. önce copy edeceksin. sonra tekrar yeni mesaj butonunu tıklayıp paste ve kaydet diyeceksin. Biraz gıcık bir durum.

Haksızlıklar karşısında susanlar, dilsiz şeytanlardır!
www.metinemre.com

16

Re: Grafik - ornek

konuyu Ahmet e havale edicem smile