Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, Does anybody know how to generate excel charts from C, or if it's possible at all? For example, if I had 2 arrays that I wanted to export to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2011
    Posts
    10

    generating excel charts from c


    Hi,

    Does anybody know how to generate excel charts from C, or if it's possible at all?

    For example, if I had 2 arrays that I wanted to export to excel and graph against each other. I know how to export it to a csv file, that's no problem, but I have no idea where to start with generating a graph of the data. I can't seem to find any examples anywhere.

    I'd appreciate if someone could point me in the right direction.

    Just a simple example to show you what I mean:
    Code:
    char arr1[] = {'a','b','c'};
    int arr2[] = {10,20,30};
    
    int main () 
    {
    
    FILE *myfile= fopen ("example1.csv","w");
    
    for (int i=0; i<3; i++)
        fprintf(myfile, "%c,%d\n",arr1[i],arr2[i]);    
    
    fclose(myfile);
    return 0;
    }
    Thanks

  2. #2
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    Not sure why you'd be thinking of Excel in a Linux environment, but you could likely do your charting using rrdtool.

  3. #3
    Just Joined!
    Join Date
    Feb 2011
    Posts
    10
    oops sorry, i wrote down excel without thinking, i meant to say openoffice or something similar.

    I'll look into rrdtool too though, thanks.

  4. #4
    Linux Newbie
    Join Date
    Dec 2010
    Posts
    146
    Quote Originally Posted by dlucey View Post
    oops sorry, i wrote down excel without thinking, i meant to say openoffice or something similar.

    I'll look into rrdtool too though, thanks.
    Yup, if it was excell, you would have to reverse engineer Bill Gates' crap. And if he changed the file format... there's nothing you can do.

    You might like to have a look at ods standards, it's basically xml actually.

  5. #5
    Just Joined!
    Join Date
    Nov 2007
    Posts
    4
    If you don't need formatting, you can try exporting to CSV format.

  6. #6
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    664
    It's clear that you know how to output CSV already and that you don't need to do that or XML.

    For rrd sample code in C, have a look at the Xymon project on Sourceforge. All of its data storage and charting is rrd-based.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •