Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# Excel Chart Series Option (Change Second Plot value)

C# Excel Chart Series Option (Change Second Plot value)

Scheduled Pinned Locked Moved C#
csharpcomhelptutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fjlv2005
    wrote on last edited by
    #1

    Hi, How can we change the Excel Chart Series Option (Second Plot last value) in C#? Here is the picture in Excel http://www.flickr.com/photos/31464532@N02/2948659930/ Here is my code..

                ChartObjects chartObjects = (ChartObjects)activeSheet.ChartObjects(Type.Missing);
                Range range = activeSheet.get\_Range(cellStart, cellEnd);
                ChartObject obj = null;
                obj = chartObjects.Add(leftLocation, topLocation, chartWidth, chartHeight);
                obj.Chart.SetSourceData(range, XlRowCol.xlColumns);
                obj.Chart.HasTitle = true;
                obj.Chart.ChartTitle.Text = title;
                obj.Chart.ChartTitle.Font.Bold = true;
                
                
                obj.Chart.ChartType = XlChartType.xlBarOfPie;
                Series series = (Series)obj.Chart.SeriesCollection(1);
                **// Here Dont know how to access the Formatting Option - Second Pot Last Value :confused:**
    
                obj.Chart.ApplyDataLabels(XlDataLabelsType.xlDataLabelsShowLabelAndPercent, //XlDataLabelsType Type, 
                                                    Type.Missing,        //LegendKey, 
                                                    Type.Missing,        //AutoText, 
                                                    Type.Missing,        //HasLeaderLines, 
                                                    Type.Missing,        //ShowSeriesName, 
                                                    Type.Missing,        //ShowCategoryName,
                                                    Type.Missing,           //ShowValue, 
                                                    Type.Missing,        //ShowPercentage, 
                                                    Type.Missing,        //ShowBubbleSize, 
                                                    Type.Missing);
    

    It seems not easy to find article for this one, so if somebody can help i would really appreciate it. Thanks

    F 1 Reply Last reply
    0
    • F fjlv2005

      Hi, How can we change the Excel Chart Series Option (Second Plot last value) in C#? Here is the picture in Excel http://www.flickr.com/photos/31464532@N02/2948659930/ Here is my code..

                  ChartObjects chartObjects = (ChartObjects)activeSheet.ChartObjects(Type.Missing);
                  Range range = activeSheet.get\_Range(cellStart, cellEnd);
                  ChartObject obj = null;
                  obj = chartObjects.Add(leftLocation, topLocation, chartWidth, chartHeight);
                  obj.Chart.SetSourceData(range, XlRowCol.xlColumns);
                  obj.Chart.HasTitle = true;
                  obj.Chart.ChartTitle.Text = title;
                  obj.Chart.ChartTitle.Font.Bold = true;
                  
                  
                  obj.Chart.ChartType = XlChartType.xlBarOfPie;
                  Series series = (Series)obj.Chart.SeriesCollection(1);
                  **// Here Dont know how to access the Formatting Option - Second Pot Last Value :confused:**
      
                  obj.Chart.ApplyDataLabels(XlDataLabelsType.xlDataLabelsShowLabelAndPercent, //XlDataLabelsType Type, 
                                                      Type.Missing,        //LegendKey, 
                                                      Type.Missing,        //AutoText, 
                                                      Type.Missing,        //HasLeaderLines, 
                                                      Type.Missing,        //ShowSeriesName, 
                                                      Type.Missing,        //ShowCategoryName,
                                                      Type.Missing,           //ShowValue, 
                                                      Type.Missing,        //ShowPercentage, 
                                                      Type.Missing,        //ShowBubbleSize, 
                                                      Type.Missing);
      

      It seems not easy to find article for this one, so if somebody can help i would really appreciate it. Thanks

      F Offline
      F Offline
      fjlv2005
      wrote on last edited by
      #2

      I finally got the solution :

                  ChartGroup gp = (ChartGroup)obj.Chart.ChartGroups(1);
                  gp.SplitValue = 3;
      

      I replied to my mail so that this may serve as help also to others. Thanks for the effort of those who tried to response.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups