This is a migrated thread and some comments may be shown as answers.

AxiscrossingPoints not working in RadHtmlChart

1 Answer 183 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
sri harsha
Top achievements
Rank 1
sri harsha asked on 21 Aug 2018, 11:34 AM

Hi, I have a date valued x-axis for my radhtmlchart and 2 additional yaxis programmed which are by default aligned to left side.

I am trying to position those additional y-axis to right side of the chart through "axis crossing points", but i am not able to do so. 

Here is my code:

objRadChart.ID = "radChart";
            objRadChart.Width = 800;
            objRadChart.Height = 650;
            objRadChart.ChartTitle.Text = DreamConstants.OACLEENERGY_WELLPERCOMPL + UWBI + " ," + WellZone;
            objRadChart.Zoom.Enabled = true;
            objRadChart.Zoom.MouseWheel.Enabled = true;
            objRadChart.Zoom.Selection.Enabled = true;
            objRadChart.Zoom.Selection.ModifierKey = Telerik.Web.UI.HtmlChart.ModifierKey.Shift;
            objRadChart.Zoom.MouseWheel.Lock = Telerik.Web.UI.HtmlChart.AxisLock.Y;
            objRadChart.Pan.Enabled = true;
            objRadChart.Legend.Appearance.Position = Telerik.Web.UI.HtmlChart.ChartLegendPosition.Bottom;
            objRadChart.Legend.Appearance.Visible = true;
            objRadChart.Legend.Appearance.BackgroundColor = Color.Transparent;

            objRadChart.PlotArea.XAxis.Name = DreamConstants.MONTH;
            objRadChart.PlotArea.YAxis.Color = Color.Green;
            objRadChart.PlotArea.XAxis.BaseUnit = Telerik.Web.UI.HtmlChart.DateTimeBaseUnit.Days;
            objRadChart.PlotArea.XAxis.Type = Telerik.Web.UI.HtmlChart.AxisType.Date;
            objRadChart.PlotArea.XAxis.LabelsAppearance.DataFormatString = "MMM yyyy";
            objRadChart.PlotArea.XAxis.LabelsAppearance.RotationAngle = 45;
            objRadChart.PlotArea.XAxis.MaxDateValue = DateTime.Parse("01/Sep/2011");
            objRadChart.PlotArea.XAxis.TitleAppearance.Text = DreamConstants.MONTH; ;

            objRadChart.PlotArea.YAxis.Name = DreamConstants.OIL_BBLPERD;
            objRadChart.PlotArea.YAxis.MinValue = 0;
            objRadChart.PlotArea.YAxis.MaxValue = 14000;
            objRadChart.PlotArea.YAxis.TitleAppearance.Text = DreamConstants.OIL_BBLPERD;

            objRadChart.PlotArea.XAxis.AxisCrossingPoints.Add(0);
            objRadChart.PlotArea.XAxis.AxisCrossingPoints.Add(objDataRange.Rows.Count);
            AxisY yAxisGasMFC = new AxisY();
            yAxisGasMFC.Name = DreamConstants.GAS_MCFPERD;
            yAxisGasMFC.TitleAppearance.Text = DreamConstants.GAS_MCFPERD;
            yAxisGasMFC.TitleAppearance.TextStyle.Color = Color.Red;
            yAxisGasMFC.MinValue = 0;
            yAxisGasMFC.MaxValue = 18000;
            objRadChart.PlotArea.AdditionalYAxes.Add(yAxisGasMFC);

            objRadChart.PlotArea.XAxis.AxisCrossingPoints.Add(0);
            objRadChart.PlotArea.XAxis.AxisCrossingPoints.Add(objDataRange.Rows.Count);
            AxisY yAxisGOR = new AxisY();
            yAxisGOR.TitleAppearance.Text = DreamConstants.GOR;
            yAxisGOR.Name = DreamConstants.GOR;
            yAxisGOR.MinValue = 0;
            yAxisGOR.MaxValue = 2000;
            objRadChart.PlotArea.AdditionalYAxes.Add(yAxisGOR);

            //Data ops
            objDataRange = objDotNetResponseHandler.GetResponseRange();
            DataView objDataView = objDataRange.DefaultView;
            objDataView.Sort = DreamConstants.MONTH_ASC;

            ScatterLineSeries sls1 = new ScatterLineSeries();
            sls1.DataFieldX = "Month";
            sls1.DataFieldY = "Gas";
            sls1.AxisName = DreamConstants.GAS_MCFPERD;
            sls1.LabelsAppearance.Visible = false;
            sls1.Appearance.FillStyle.BackgroundColor = Color.Red;
            sls1.Name = "Gas";
            objRadChart.PlotArea.Series.Add(sls1);
            
            ScatterLineSeries sls2 = new ScatterLineSeries();
            sls2.DataFieldX = "Month";
            sls2.DataFieldY = "Oil";
            sls2.LabelsAppearance.Visible = false;
            sls2.Appearance.FillStyle.BackgroundColor = Color.Green;
            sls2.Name = "Oil";
            objRadChart.PlotArea.Series.Add(sls2);            

            ScatterLineSeries sls3 = new ScatterLineSeries();
            sls3.DataFieldX = "Month";
            sls3.DataFieldY = "GOR";
            sls3.AxisName = DreamConstants.GOR;
            sls3.LabelsAppearance.Visible = false;
            sls3.Appearance.FillStyle.BackgroundColor = Color.Blue;
            sls3.LineAppearance.Width = 0;
            sls3.MarkersAppearance.MarkersType = Telerik.Web.UI.HtmlChart.MarkersType.Cross;
            sls3.Name = "Gor";
            objRadChart.PlotArea.Series.Add(sls3);

            ScatterLineSeries sls4 = new ScatterLineSeries();
            sls4.DataFieldX = "Month";
            sls4.DataFieldY = "Water";
            sls4.LabelsAppearance.Visible = false;
            sls4.Appearance.FillStyle.BackgroundColor = Color.Purple;
            sls4.Name = "Water";
            objRadChart.PlotArea.Series.Add(sls4);

            ScatterLineSeries sls5 = new ScatterLineSeries();
            sls5.DataFieldX = "Month";
            sls5.DataFieldY = "WaterCut";
            sls5.LabelsAppearance.Visible = false;
            sls5.Appearance.FillStyle.BackgroundColor = Color.Magenta;
            sls5.Name = "Water Cut";
            objRadChart.PlotArea.Series.Add(sls5);

            objRadChart.DataSource = objDataView.ToTable();
            objRadChart.DataBind();

Any sort of help is appreciated. 

Thanks in advance.

 

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Aug 2018, 04:26 PM
Hello,

RadHtmlChart does not take date objects for the axis crossing point and this improvement is already present in our feedback portal. You can track its status, vote and comment on it in the following page, which also offers a workaround: https://feedback.telerik.com/Project/108/Feedback/Details/125708-improve-radhtmlchart-xaxis-axiscrossingpoint-so-that-it-accepts-datetime-object.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Chart (HTML5)
Asked by
sri harsha
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or