SamplesSeriesMarker title handling tab characters?

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

SamplesSeriesMarker title handling tab characters?

Post by greggorob64 » Thu Apr 16, 2015 2:51 pm

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

User avatar
ArctionPasi
Posts: 1366
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: SamplesSeriesMarker title handling tab characters?

Post by ArctionPasi » Thu Apr 16, 2015 3:02 pm

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 6199 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();
LightningChart Support Team, PT

greggorob64
Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: SamplesSeriesMarker title handling tab characters?

Post by greggorob64 » Fri Apr 17, 2015 11:52 am

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