need help in pie chart

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • muddasirmunir
    Contributor
    • Jan 2007
    • 284

    need help in pie chart

    i had developed an accouting software and in this i made some chart
    for this i used MSChart .
    As long as charting is concerned it is working fine all the chart is showing the desired results. the problem only arise in pie chart


    well , when i use the chart type as

    Code:
     VtChChartType2dPie
    the chart show the data (let says sale of six month) by representing six circles size according to each month sales
    now i want the chart to be look like just as pie chart in Excel that is for six months sale it has to show me only one circle the the sale of each month will shown as portion in the same circle.

    I think this will clear to you what i actually want.
    Is there any other control is available to draw charts or not?
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by muddasirmunir

    the chart show the data (let says sale of six month) by representing six circles size according to each month sales
    now i want the chart to be look like just as pie chart in Excel that is for six months sale it has to show me only one circle the the sale of each month will shown as portion in the same circle.

    I think this will clear to you what i actually want.
    Is there any other control is available to draw charts or not?
    I have not much experience using this type of charts, but i'll say it's because the variables are in the wrong dimension of the array. i.e.

    Lets say the application will plot the columns, and your info is like this:

    _______________ _______________ _______________ _
    | Month1 | Month 2 | Month 3 | Month 4 | Month 5 | Month 6 |
    --------------------------------------------------------------------------

    you need it like this

    _______
    |Month 1|
    -----------
    |Month 2|
    -----------
    |Month 3|
    -----------
    |Month 4|
    -----------

    I'll say that transposing your array, or simply adding it a second dimension will do, i.e.

    If you have
    arr(1) = month 1
    arr(2) = month 2
    arr(3) = month 3
    arr(4) = month 4
    try with
    arr(1,1) = month 1
    arr(2,1) = month 2
    arr(3,1) = month 3
    arr(4,1) = month 4
    or with
    arr(1,1) = month 1
    arr(1,2) = month 2
    arr(1,3) = month 3
    arr(1,4) = month 4

    HTH
    Last edited by kadghar; Feb 13 '08, 05:57 PM. Reason: Argh, hate that its so hard to make them look like tables

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Just a tip, kadghar. If you use a CODE tag, everything will line up better. :)

      Comment

      • muddasirmunir
        Contributor
        • Jan 2007
        • 284

        #4
        tell me how upload pictures here in message i think i will describe my problem more effiently with the help of picture

        i did not understand what you both are saying.
        i am taking data from sqlserver ,
        my problem is not of data but the pictures that graphes shows
        i just want a pie chart which shows only one circle and the show the amount of sales in that circle by colouring the same circle in differenc colours.
        currently if i want to disply the sales it shoes me (if i take six moth data)
        six different circles each circle is as big as the amout of sales as on that month

        is there any thing which i am dioing wroing becuase all the other graphs like linegraph and bar graph and area graph are showing correct pictures.
        Last edited by debasisdas; Feb 14 '08, 10:55 AM. Reason: Typo

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          Set the Property of Chart Control to
          RowCount =1
          and ChartType = VtChChartType2d Pie

          You will get Single Circle with all 6 different Shares..

          REgards
          Veena

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            Originally posted by muddasirmunir
            tell me how upload pictures here in message i think i will describe my problem more effiently with the help of picture
            Post the thread .
            Click Edit/Delete
            Attach the the file and save.


            You have to do all that with in stipulated time period.

            Comment

            • muddasirmunir
              Contributor
              • Jan 2007
              • 284

              #7
              Hi QVeena and other experts see the link (third post) by me where

              i had attached pictures to define my problem cleary
              Also QVeena your suggestion to make rowcount=1 does not working
              properly and it show only one month data.
              the link is

              http://www.dreamincode.net/forums/in...0&gopid=309957&


              please give some solution to me

              Comment

              • QVeen72
                Recognized Expert Top Contributor
                • Oct 2006
                • 1445

                #8
                Hi,

                Have you Set Number of Columns and Column Data...?
                And You will get a 2-d Picture of the Pie Chart, With MSChart Control, you cannot get as like Excel Chart..

                Regards
                Veena

                Comment

                • muddasirmunir
                  Contributor
                  • Jan 2007
                  • 284

                  #9
                  i did not set not of colums.
                  tell me if MSChart Control did not draw a pie chart which i want did you
                  know any other chart control which make it and if so where can i find it
                  because i had search a lot in yahoo for graps ocx but did not get any
                  use ful information/control.

                  Originally posted by QVeen72
                  Hi,

                  Have you Set Number of Columns and Column Data...?
                  And You will get a 2-d Picture of the Pie Chart, With MSChart Control, you cannot get as like Excel Chart..

                  Regards
                  Veena

                  Comment

                  • Killer42
                    Recognized Expert Expert
                    • Oct 2006
                    • 8429

                    #10
                    Having had a look at the link, I'm surprised it's even possible for MSChart to produce that bunch of circles. Looks like some kind of bug. Is it possible the numbers are too big or something, and causing the pie chart code to become confused?

                    Perhaps you could try it with smaller numbers, just to check.

                    Comment

                    • kadghar
                      Recognized Expert Top Contributor
                      • Apr 2007
                      • 1302

                      #11
                      Originally posted by Killer42
                      Having had a look at the link, I'm surprised it's even possible for MSChart to produce that bunch of circles....
                      It can, because its putting many charts in the same parent.

                      if you have Table A:
                      Code:
                      -------------------------
                      | a11 | a12 | a13 | a14 |
                      -------------------------
                      | a21 | a22 | a23 | a24 |
                      -------------------------
                      | a31 | a32 | a43 | a34 |
                      -------------------------
                      | a41 | a42 | a43 | a44 |
                      -------------------------
                      if you make a bars chart, it'll make 4 bars, each bar divided into 4 sections.
                      if you make a pie chart, it'll make 4 pies, each one divided in 4 sections.

                      The difference is that a bars chart allows tables, a pie one doesnt, so it'll make many charts.

                      if you only have

                      Code:
                      -------------------------
                      | a11 | a12 | a13 | a14 |
                      -------------------------
                      it'll make 4 bars, each one of one section, or it'll make 4 pies, each one of 1 section.

                      If you have
                      [CODE=vb]-------
                      | a11 |
                      -------
                      | a21 |
                      -------
                      | a31 |
                      -------
                      | a41 |
                      -------[/CODE]

                      It'll create 1 bar or 1 pie, divided in 4 sections.

                      so if you have
                      Chart1.ChartDat a = Values
                      where Values is an array, just do as i told you in my previous post.

                      Transposing can be done like this:

                      [CODE=vb]dim ValuesT()
                      dim i as long
                      dim j as long
                      redim valuest (ubound(values, 2), ubound(values))
                      for i = lbound(values,2 ) to ubound(values,2 )
                      for j = lbound(values) to ubound(values)
                      valuest(i,j) = values(j,i)
                      next
                      next[/CODE]

                      now use

                      Chart1.ChartDat a = ValuesT

                      If it tells you that ubound(values,2 ) is an error, replace all ubounds and lbounds of the second dimension with 1, and values(j,i) with values(j)

                      Well, i hope this help you somehow.

                      Comment

                      • kadghar
                        Recognized Expert Top Contributor
                        • Apr 2007
                        • 1302

                        #12
                        oh, i forgot,

                        If this still not working, Transpose once again the ValuesT table,

                        This will be because i think you have an array of one dimension, this is going to create an array of two dimensions, where the size of the first dimension is one, and the second is six. But it might need a two dimensioned array where the first dimension is six and the second one is one. So you'll have to transpose it again.

                        Anyway, i hope it works fine the first time you transpose it.

                        PS. thanks Killer, code tags rock with tables

                        Comment

                        • Killer42
                          Recognized Expert Expert
                          • Oct 2006
                          • 8429

                          #13
                          Originally posted by kadghar
                          PS. thanks Killer, code tags rock with tables
                          You're welcome. Now, if only we could get rid of the line numbers it would be perfect.

                          Comment

                          • kadghar
                            Recognized Expert Top Contributor
                            • Apr 2007
                            • 1302

                            #14
                            Originally posted by Killer42
                            You're welcome. Now, if only we could get rid of the line numbers it would be perfect.
                            I always use Courier New as my default font. All its characters are the same size, so its great for making tables and ascii pictures ^.^

                            Code:
                            .      |||
                                  (^ ^)
                            ---ooO-(_)-Ooo---
                            |  Vote for     |
                            |  Courier New  |
                            |  as default   |
                            -----------------

                            Comment

                            • QVeen72
                              Recognized Expert Top Contributor
                              • Oct 2006
                              • 1445

                              #15
                              Originally posted by muddasirmunir
                              i did not set not of colums.
                              tell me if MSChart Control did not draw a pie chart which i want did you
                              know any other chart control which make it and if so where can i find it
                              because i had search a lot in yahoo for graps ocx but did not get any
                              use ful information/control.
                              Hi,

                              Why dont you use Excel Chart itself..?
                              It looks good and you can set all the parameters from the code..

                              Regards
                              Veena

                              Comment

                              Working...