Page 1 of 1

SamplesSeriesMarker title handling tab characters?

Posted: Thu Apr 16, 2015 2:51 pm
by greggorob64
I'm working with some sampleseriesmarkers. When I work with standard windows tooltips, it handles the \t, and it looks great, and handles it well.

When I add the \t to a sampleseriesmarker title, it is completely ignored. I am instead having to use " " as my separator.

a) Is there any way we can get the title to respect the \t character?
b) It would be great if it was smart enough to align labels nicely (much harder)

Thanks!

(screenshot is using 3 spaces instead of \t because the \t is just skipped over)
Image

Re: SamplesSeriesMarker title handling tab characters?

Posted: Thu Apr 16, 2015 3:02 pm
by ArctionPasi
Use monospace font and string formatting commands.
Cursor tracking example - annotation with aligned texts
Cursor tracking example - annotation with aligned texts
cursorTracking.jpg (654.66 KiB) Viewed 7585 times

Code: Select all

StringBuilder sb = new StringBuilder();
            int iSeriesNumber = 1;

            string strChannelStringFormat = "Mill {0}: {1,12:#####.###} {2}";
            bool bLabelVisible = false;
            bool bAccurate = radioButtonAccurate.Checked;
            string strValue=""; 

            foreach (PointLineSeries series in m_chart.ViewXY.PointLineSeries)
            {
                //show series titles and cursor values in them, on the right side of the chart, 
                //if cursor values are not shown next to the cursor in an annotation
                series.Title.Visible = !bShowNextToCursor;
                bool bResolvedOK = false;
                strValue = "";

                if(bAccurate)
                    bResolvedOK = SolveValueAccurate(series, cursor.ValueAtXAxis, out dSeriesYValue); 
                else 
                    bResolvedOK = SolveValueCoarse(series, cursor.ValueAtXAxis, out dSeriesYValue);

                AxisY axisY = m_chart.ViewXY.YAxes[series.AssignYAxisIndex];

                if (bResolvedOK)
                {
                    bLabelVisible = true;
                    strValue = string.Format(strChannelStringFormat, iSeriesNumber, dSeriesYValue.ToString("0.0"), axisY.Units.Text);
                }
                else
                {
                    strValue = string.Format(strChannelStringFormat, iSeriesNumber, "---", axisY.Units.Text);
                }
                sb.AppendLine(strValue);
                series.Title.Text = strValue;
                iSeriesNumber++;
            }
            
            sb.AppendLine("");
            sb.AppendLine("Time: " + m_chart.ViewXY.XAxes[0].TimeString(cursor.ValueAtXAxis, "HH:mm:ss.ffff"));

            //Set text
            cursorValueDisplay.Text = sb.ToString();

Re: SamplesSeriesMarker title handling tab characters?

Posted: Fri Apr 17, 2015 11:52 am
by greggorob64
I was hoping not to go in that direction, but it seems like the best bet. We're trying to move to this awesome new looking charting package, and monospaced fonts are ugly :P