Author |
Topic  |
|
DRockWilson
USA
9 Posts |
Posted - 11 Dec 2015 : 11:43:35
|
I have a SPCBatchVariableControlChart that has chart.XAxisStringLabelMode = SPCChartObjects.AXIS_LABEL_MODE_TIME.
How do you get multi-line x-axis labels with the date and time like you have in the following chart example?
http://www.quinn-curtis.com/QCSPCC52.jpg |
Edited by - DRockWilson on 02 Feb 2016 12:58:59 |
|
quinncurtis
1586 Posts |
Posted - 11 Dec 2015 : 14:09:35
|
That's a time variable control chart you are showing, and the axis labeling is handled differently for a time axis. As you will note, in a time variable control chart, not every sample interval is labeled, while in the case of a batch variable control chart every sample interval is labeled. But, you can achieve the same effect using a custom date/time format string ("HH:mm\nMM/dd"), except that every axis sample interval tick mark will include a date, by adding the following code to your batch control chart setup. Something like:
this.XAxisStringLabelMode = SPCChartObjects.AXIS_LABEL_MODE_TIME; this.XAxisCustomDateTimeFormatString = "HH:mm\nMM/dd"; this.XAxisOverlapLabelMode = ChartObj.OVERLAP_LABEL_DRAW;
This XAxisOverlapLabelMode = ChartObj.OVERLAP_LABEL_DRAW allows the axis labels to be packed closer together. If you plan to use longer time/date strings you may need to reduce the number of sample intervals you display in a page (set using the property numdatapointsinview in all of our examples) to prevent the labels from overlapping.
Note that the custom format string includes a newline character, "\n" to place the time and date on separate lines. The custom time/date formatting string follows the same pattern as regular .Net time/date formatting: https://msdn.microsoft.com/en-us/library/8kb3ddd4%28v=vs.110%29.aspx
|
 |
|
DRockWilson
USA
9 Posts |
Posted - 11 Dec 2015 : 16:11:09
|
Thank you |
 |
|
DRockWilson
USA
9 Posts |
Posted - 02 Feb 2016 : 12:58:34
|
My users had one more request that I don't know if it is possible or not but I figured I would ask because I couldn't determine it based on my research in the documentation. Is it possible to change the x-axis label color based on the ChartCalendar that is stored in the Sample Record? They want to do this to see what is a continuous run of the same day versus what ran the previous day.
For example, the users want the X-Axis Date/Time labels that are not from today changed to a different color, but leave anything from today with a black label.
Here is how I am adding the data. chart.ChartData[] is what is holding all my values and times.
int sampleSize = 5 int pointsPerChart = 10 DoubleArray samples = new DoubleArray(Convert.ToInt32(sampleSize)); int j = 0; int batchCounter = 0;
for (int i = (sampleSize * pointsPerChart) - 1); i >= 0; i--) { samples[j] = Convert.ToDouble(chart.ChartData[i].Value);
if (i % sampleSize == 0) { ChartCalendar timeStamp = new ChartCalendar(chart.ChartData[i].Time); spcChart.ChartData.AddNewSampleRecord(batchCounter, timeStamp, samples); samples = new DoubleArray(Convert.ToInt32(sampleSize)); batchCounter++; j = 0; } else j++; }
And I have the following set this.XAxisStringLabelMode = SPCChartObjects.AXIS_LABEL_MODE_TIME; this.XAxisCustomDateTimeFormatString = "HH:mm\nMM/dd/yy"; this.XAxisOverlapLabelMode = ChartObj.OVERLAP_LABEL_DRAW;
|
 |
|
quinncurtis
1586 Posts |
Posted - 02 Feb 2016 : 17:14:25
|
Sorry, but what you describe cannot be done with the software in its current form. All of the axis labels for a given axis have the same color. If it is critical to the application we could undertake it as a custom programming project. Let us know if you need a quote. |
 |
|
DRockWilson
USA
9 Posts |
Posted - 03 Feb 2016 : 13:27:47
|
Not a huge deal. It was one of those nice to have requests. I kind of figured it couldn't be done based on the documentation, but I figured it couldn't hurt to ask. |
 |
|
|
Topic  |
|