Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
690
WinChart: How to add information from multiple columns to (x-)Axis label?
posted
Hi

I have a winchart showing the cyclenumber on the x-axis and some electrical power information on the y-axis.
A row in the datatable has three columns
ist_zyklen (=cyclenumber)
yAchse     (=electrical power information (its a variable for the desired y column from the datatable))
date       (a date)

with the code below, I get labels for the cyclenumbers on the x-Axis, e.g.
|
|
|
_____________________________________________________________________________
3e+01                      5e+01             8e+01 etc

what I need is to show the labels including the date value.
|
|
|
_____________________________________________________________________________
3e+01                      5e+01             8e+01 etc
06/18/2015 08:03           06/18/2015 09:11  06/18/2015 10:32                

I tried to add the "labelColumn" for the series1.DataBind(dt, "ist_zyklen", yAchse, <labelColumn>);
but with no success

public void setGraphics(DataTable dt, string yAchse, UltraChart chart, double? xMin, double? xMax, double? yMin, double? yMax) {
            chart.ChartType = ChartType.Composite;
            ChartArea area = new ChartArea();
            chart.CompositeChart.ChartAreas.Add(area);
 
            AxisItem axisX = new AxisItem();
            axisX.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            axisX.Labels.ItemFormatString = "<DATA_VALUE:E1>";
            axisX.RangeType = AxisRangeType.Custom;
            axisX.RangeMin = (double)(xMin ?? 0);
            axisX.RangeMax = (double)(xMax == 0 || xMax == null ? Math.Round(getMax(dt, "ist_zyklen")) * 1.1 : xMax);
            axisX.LogBase = 1000000;
            axisX.Labels.Orientation = TextOrientation.Horizontal;
            axisX.Extent = 60;
            area.Axes.Add(axisX);
 
            AxisItem axisY = new AxisItem();
            axisY.Labels.ItemFormatString = "<DATA_VALUE:####.##>"; 
            axisY.RangeType = AxisRangeType.Custom;                 
            axisY.RangeMin = (double)(yMin ?? 0);
            axisY.RangeMax = (double)(yMax == 0 || yMax == null ? Math.Round(getMax(dt, yAchse)) * 1.1 : yMax);
            axisY.OrientationType = AxisNumber.Y_Axis;
            axisY.Extent = 30;
            axisY.Margin.Far.Value = 15;
            area.Axes.Add(axisY);
 
            XYSeries series1 = new XYSeries();
            series1.DataBind(dt, "ist_zyklen", yAchse);
            series1.PEs.Add(new PaintElement(Color.SteelBlue));
 
            ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
            myColumnLayer.ChartType = ChartType.ScatterChart;
            myColumnLayer.ChartArea = area;
            myColumnLayer.Series.Add(series1);
            myColumnLayer.AxisX = axisX;
            myColumnLayer.AxisY = axisY;
            chart.CompositeChart.Series.Add(series1);
            chart.CompositeChart.ChartLayers.Add(myColumnLayer);
...
Parents Reply Children