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.

int width = 400;
int height = 300;

Bitmap bmpChart = new Bitmap(width, height, PixelFormat.Format16bppRgb555);
			
OWC11.ChartSpace chSpace = new ChartSpaceClass();
				 
ChChart chart = chSpace.Charts.Add(0);
chart.SeriesCollection.Add(0);
chart.SeriesCollection[0].Type = ChartChartTypeEnum.chChartTypeColumn3D;

// Series names
chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "test");
			
chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "a,b,c");
			
chart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "5,10,15"); 


chart.SeriesCollection.Add(1); // series collection xbar
			
chart.SeriesCollection[1].Type = ChartChartTypeEnum.chChartTypeLine;

chart.SeriesCollection[1].Marker.Size = 6; // marker size
chart.SeriesCollection[1].Interior.Color = "Red"; // marker color

chart.SeriesCollection[1].Marker.Style = ChartMarkerStyleEnum.chMarkerStyleCircle; // marker style
			
chart.SeriesCollection[1].Line.Color = "Red";
			
// Set line weight.
chart.SeriesCollection[1].Line.set_Weight((LineWeightEnum)int.Parse("3"));
		
// Series names
chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimSeriesNames, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "test");

chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimCategories, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "a,b,c");
			
chart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues, Convert.ToInt32(ChartSpecialDataSourcesEnum.chDataLiteral), "20,25,30");

chart.HasLegend = true;
chart.Legend.Position = ChartLegendPositionEnum.chLegendPositionRight;
chart.Axes[0].Orientation = Convert.ToInt32(OWC11.ChartLabelOrientationEnum.chLabelOrientationHorizontal);

return chSpace;

If you have any solution, please reply to this thread. Thanks in advance.

I managed to solve this myself. I just translated a VB example from Microsoft.

{ 
            int width = 400; 
            int height = 300; 
  
            Bitmap bmpChart = new Bitmap(width, height, PixelFormat.Format16bppRgb555); 
  
            OWC11.ChartSpace chSpace = new ChartSpaceClass(); 
  
            chSpace.Clear(); 
  
            ChChart chart = chSpace.Charts.Add(0); 
  
            OWC11.ChSeries series1 = chart.SeriesCollection.Add(0); 
            //series1.Caption = "sales"; 
            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"); 
            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");  
            series1.Interior.Color = "#CCFFFF"; 
            series1.GapWidth = 0; 
            series1.Type = ChartChartTypeEnum.chChartTypeColumnClustered; 
  
            series1.DataLabelsCollection.Add(); 
               series1.DataLabelsCollection[0].Font.Name = "Arial"; 
            series1.DataLabelsCollection[0].Font.Size = 9; 
            //series1.DataLabelsCollection[0].Font.Bold = true; 
  
            OWC11.ChSeries series2 = chart.SeriesCollection.Add(1); 
            //series2.Caption = "profit"; 
            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"); 
            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");  
            series2.Line.Color = "Black"; 
            series2.Type = ChartChartTypeEnum.chChartTypeSmoothLine; 
  
            chart.Axes[1].Scaling.Minimum = 0; 
            //chart.Axes[1].Scaling.Maximum = 320; 
  
            chart.Interior.SetSolid("#CCFFFF"); 
  
            chart.PlotArea.Interior.SetPatterned(ChartPatternTypeEnum.chPattern90Percent, "White", "Black"); 
            chart.Axes[1].HasMajorGridlines = false;//  Line.set_Weight((LineWeightEnum.owcLineWeightHairline)); // Y-Axis line color 
  
            chart.Border.Color = "Black"; 
  
            return chSpace; 
        }

Hi,

I am adding 2 data series to a chart, Both are of type column clursted charts. I am setting data values to both the series, but the values of data series1 and data series2 are getting overlapped in the chart.

How to resolve this? Please help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.