Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Making Pie Charts in C#

Lalit S. RanaLalit S. Rana Member Posts: 2
Hi,
Friends I am going to make a pie chart control in C#.
Could you please tell whether I will have to draw it bit by bit (using circle, ellipse etc) or there is any ready made method.
I want to make a real good control
Thanks
Lalit

Comments

  • stevencohnstevencohn Member Posts: 1
    The easiest and most powerful charting component I've seen is the Microsoft charting controls from the Microsoft Office XP Web Components 10 library. If you don't have Office XP installed, you can download the Web Components library from the MS Office site. You can create amazing professional charts of all types with just a few lines of code. And it's free!

    Here's some code ripped from a WSH program I wrote a while ago:



    space.clear();
    space.border.color = report.RGB(0xFFFFFF);

    // see function below...
    report.addPieChart(browser.name+" Versions",categories,values);

    space.exportPicture(filnam,"gif",width/2,height);

    // addPieChart function
    function Report.prototype.addPieChart (chtitle,categories,values) // [explodeMod]
    {
    var cons = space.constants;
    var chart = space.charts.add();

    with (chart)
    {
    hasTitle = true;
    with (title)
    {
    caption = chtitle;
    font.name = "Verdana";
    font.size = 7.5;
    font.bold = true;
    }
    type = cons.chChartTypePie3D;
    hasLegend = true;
    inclination = 50;
    }

    var unknown = 100;
    for (var i=0; i < values.length; i++)
    {
    unknown -= values[i];
    }

    if (unknown >= 10)
    {
    categories.push("(unknown) - " + Number.formatFloat(unknown,1));
    values.push(unknown);
    }

    series = chart.seriesCollection.add();
    series.thickness = 5;
    series.setData(cons.chDimCategories,cons.chDataLiteral,categories);
    series.setData(cons.chDimValues,cons.chDataLiteral,values);

    if (unknown >= 10)
    {
    var point = series.points(series.points.count-1);
    point.interior.color = "#E6E6E6";

    var explode = (arguments.length > 3 ? arguments[3] : false);
    if (explode) point.explosion = 30;
    }

    return(chart);
    }



  • Andre YoungAndre Young USAMember Posts: 0

    _______ // http://forcoder.org // free ebooks and video tutorials about [ Java, Visual Basic .NET, Assembly, Swift, Delphi, C#, Scratch, R, Objective-C, Python, JavaScript, PL/SQL, C, Perl, MATLAB, PHP, C++, Visual Basic, Ruby, Go Prolog, F#, Scala, ABAP, Logo, Apex, FoxPro, Lua, Fortran, Scheme, Crystal, LabVIEW, Erlang, Bash, ML, Clojure, Julia, Transact-SQL, Lisp, Rust, VBScript, SAS, Hack, Kotlin, Alice, Awk, Dart, COBOL, Ada, D ] ____

Sign In or Register to comment.