473,471 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OWC 11: Is it possible to have combination chart?

6 New Member
I am using OWC 11 in my new web application for displaying charts.
Is it possible in OWC 11 to combine and display a column and a line graph (Looking like they overlap each other)?
I tried it using this code but it doesn' t work.

Expand|Select|Wrap|Line Numbers
  1.  
  2. int width = 400;
  3. int height = 300;
  4.  
  5. Bitmap bmpChart = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
  6.  
  7. OWC11.ChartSpace chSpace = new ChartSpaceClass();
  8.  
  9. ChChart chart = chSpace.Charts.Add(0);
  10. chart.SeriesCollection.Add(0);
  11. chart.SeriesCollection[0].Type = ChartChartTypeEnum.chChartTypeColumn3D;
  12.  
  13. // Series names
  14. chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "test");
  15.  
  16. chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "a,b,c");
  17.  
  18. chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "5,10,15"); 
  19.  
  20.  
  21. chart.SeriesCollection.Add(1); // series collection xbar
  22.  
  23. chart.SeriesCollection[1].Type = ChartChartTypeEnum.chChartTypeLine;
  24.  
  25. chart.SeriesCollection[1].Marker.Size = 6; // marker size
  26. chart.SeriesCollection[1].Interior.Color = "Red"; // marker color
  27.  
  28. chart.SeriesCollection[1].Marker.Style = ChartMarkerStyleEnum.chMarkerStyleCircle; // marker style
  29.  
  30. chart.SeriesCollection[1].Line.Color = "Red";
  31.  
  32. // Set line weight.
  33. chart.SeriesCollection[1].Line.set_Weight((LineWeightEnum)int.Parse("3"));
  34.  
  35. // Series names
  36. chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimSeriesNames, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "test");
  37.  
  38. chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "a,b,c");
  39.  
  40. chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "20,25,30");
  41.  
  42. chart.HasLegend = true;
  43. chart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
  44. chart.Axes[0].Orientation = Convert.ToInt32(OWC11.ChartLabelOrientationEnum.chLabelOrientationHorizontal);
  45.  
  46. return chSpace;
  47.  
If you have any solution, please reply to this thread. Thanks in advance.
Feb 24 '09 #1
1 4994
cubekid
6 New Member
I managed to solve this myself. I just translated a VB example from Microsoft.

Expand|Select|Wrap|Line Numbers
  1. {
  2.             int width = 400;
  3.             int height = 300;
  4.  
  5.             Bitmap bmpChart = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
  6.  
  7.             OWC11.ChartSpace chSpace = new ChartSpaceClass();
  8.  
  9.             chSpace.Clear();
  10.  
  11.             ChChart chart = chSpace.Charts.Add(0);
  12.  
  13.             OWC11.ChSeries series1 = chart.SeriesCollection.Add(0);
  14.             //series1.Caption = "sales";
  15.             series1.SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24");
  16.             series1.SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "0, 0, 0, 4, 268, 44, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0"); 
  17.             series1.Interior.Color = "#CCFFFF";
  18.             series1.GapWidth = 0;
  19.             series1.Type = ChartChartTypeEnum.chChartTypeColumnClustered;
  20.  
  21.             series1.DataLabelsCollection.Add();
  22.                series1.DataLabelsCollection[0].Font.Name = "Arial";
  23.             series1.DataLabelsCollection[0].Font.Size = 9;
  24.             //series1.DataLabelsCollection[0].Font.Bold = true;
  25.  
  26.             OWC11.ChSeries series2 = chart.SeriesCollection.Add(1);
  27.             //series2.Caption = "profit";
  28.             series2.SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24");
  29.             series2.SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "0, 9.85, 0.001, 2.43, 112.52, 195.80, 15.22, 0.03, 1.18, 7.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0"); 
  30.             series2.Line.Color = "Black";
  31.             series2.Type = ChartChartTypeEnum.chChartTypeSmoothLine;
  32.  
  33.             chart.Axes[1].Scaling.Minimum = 0;
  34.             //chart.Axes[1].Scaling.Maximum = 320;
  35.  
  36.             chart.Interior.SetSolid("#CCFFFF");
  37.  
  38.             chart.PlotArea.Interior.SetPatterned(ChartPatternTypeEnum.chPattern90Percent, "White", "Black");
  39.             chart.Axes[1].HasMajorGridlines = false;//  Line.set_Weight((LineWeightEnum.owcLineWeightHairline)); // Y-Axis line color
  40.  
  41.             chart.Border.Color = "Black";
  42.  
  43.             return chSpace;
  44.         }
  45.  
Feb 27 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Chris Lasher | last post by:
Hello, I would like to create a set of very similar regular expression. In my initial thought, I'd hoped to create a regular expression with a variable inside of it that I could simply pass a...
36
by: rbt | last post by:
Say I have a list that has 3 letters in it: I want to print all the possible 4 digit combinations of those 3 letters: 4^3 = 64 aaaa
2
by: Klaus Nowikow | last post by:
I would like to be able to do the following: std::cout // Or any other ostream << "Line 1\n" << push_tab << "Line 2\n" << "Line 3\n" << push_tab << "Line 4\n" << pop_tab
22
by: PeteCresswell | last post by:
I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp, but still don't have a clue. For example, I've got a chart object namde...
0
by: spm_no | last post by:
Hi, I am using Access 2002 and am creating a scatter-chart on a form in which the X-axis is a date. I can format and display the x-axis properly as a date. However, when I close and reopen...
1
by: Steven | last post by:
Hi there, I am trying to export a chart using the Excel11 object from C#. I can properly open workbooks and read cells, but calling Export() on the Chart object throws a COMException ...
1
by: Herbert Chan | last post by:
Hello, I'm subscribing to funds on HSBC, and the fund prices can be found here: http://www.tools.hsbc.com.hk/search/mpf?id=hk+mpf+fundsearch&lang=en&init=true At the moment, I'm copying each...
1
by: Bartholomew Simpson | last post by:
I'm building an application that has realtime charting and allows a user to interact with displayed chart (drag and drop, zoom, select items in chart, add anotations to chart etc). I haven't...
0
by: AccessAcct | last post by:
I want to chart the values from a list box on my form without having to go back to the table holding the data, is this possible? I have a list box that has a user defined criteria, when it is set...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.