ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Origin questions
Posted by KeithB on Dec-15-2023 22:56
First, thanks for such a great tool. I ceded a wafermapping app in a single morning!

For your wafer map demo, it has the origin at the lower right with the yaxis increasing.
My wafer fab manager wants the Y axis zero at the top of the chart. I changed the labels by setting
c.yAxis().setLinearScale(0, ydiameter, 1);
to
c.yAxis().setLinearScale(ydiameter, 0, 1);
and that did what I want - the axis was flipped, but the labels disappeared and the tooltip did not show the y-coordinate.

What did I do wrong?

Also, how do you save the chart as an image, or copy it to the clipboard?

Do you have any plans to add Smith charts?
https://en.wikipedia.org/wiki/Smith_chart

OR even control charts?

  Re: Origin questions
Posted by Peter Kwan on Dec-16-2023 01:38
Hi KeithB,

I think it should be:

c.yAxis().setLinearScale(ydiameter, 0, -1);

(The last argument should be -1.)

To save the chart as an image, you can use BaseChart.makeChart. For example:

c.makeChart("c:/my/path/aaa.png");

You can save as JPG, PNG, GIF, BMP, SVG and/or PDF.

In many programming language editions of ChartDirector, there are examples in saving chart as images or PDF. Some of them are:

https://www.advsofteng.com/doc/cdnet.htm#zoomscrollpdf.htm
https://www.advsofteng.com/doc/cdnet.htm#realtimemultichart.htm

To copy things to the clipboard, it is a function of the GUI framework. For example, in the .NET Windows Forms framework, there is a Clipboard object that can be used to save images to clipboard.

Clipboard.SetDataObject(winChartViewer1.Image, true);

Would you mind to inform me which GUI framework you are using, or is it a web application viewed with a browser?

For the Smith chart, from time to time, we have requests for this type of chart. Currently, the only method to draw it is to draw the Smith chart grid as a background image of a polar chart. It works because the Smith chart grid is static and always the same. You can then add data points using a polar scatter layer. This requires your code to convert the Smith coordinates of the data points to polar coordinates, which I think is not difficult.

For "control charts", I am not too sure which type of charts you are referring to. From time to time, we have users plotting SPC (statistical process control) charts using ChartDirector. They are normal XY charts with zones and threshold lines. The following is an example:

https://en.wikipedia.org/wiki/Smith_chart

https://www.chartdir.com/forum/download_thread.php?bn=chartdir_general&pattern=spc&thread=1145452835#N1145464327

Best Regards
Peter Kwan

  Re: Origin questions
Posted by KeithB on Dec-16-2023 02:03
That was perfect, thanks.
I saw the saving function when I was perusing the zoom and scroll XY example.

Now I am modifying the heatmap symbol example to put a little P or F in each cell.

Yeah, I had thought of that for the Smith chart. You can use an XY chart, too, but at least the polar chart starts with a circle. 8^)

I use C# with .Net 6.0 and Microsoft Visual Studio 2022.
I mainly develop test system software, but I wanted to use your library to add graphing and mapping capability.

Thanks again

  Re: Origin questions
Posted by KeithB on Dec-16-2023 03:35
Also, I am trying to set up an arbitrary label using the additional field capability

So I take the wafer map demo and add this right after zData is defined:
string[] sfield = new string[zData.Length];

for (int i = 0; i < zData.Length; ++i)
{
    if (zData[i] == Chart.NoValue)
    {
        sfield[i] = "";

    }
    else if (zData[i] > 50)
    {
        sfield[i] = "P";
    }
    else
    {
        sfield[i] = "F";
    }
}

Then I add it as additional field data:
layer.addExtraField(sfield);

Then I try to set the label:
layer.setDataLabelFormat("{Field0}");

If I use
layer.setDataLabelFormat("{z|0}");
I get the zdata in the map. With "{Field0}" I get a literal 'Field0' in each cell.

  Re: Origin questions
Posted by Peter Kwan on Dec-16-2023 04:18
Hi KeithB,

The label format is case sensitive. It needs to use lower case "{field0}".

Best Regards
Peter Kwan

  Re: Origin questions
Posted by KeithB on Dec-16-2023 04:43
That did not work, I still get a literal 'field0', instead of "P" or "F".

  Re: Origin questions
Posted by Peter Kwan on Dec-16-2023 15:02
Attachments:
Hi KeithB,

The following is the test code I used and the chart I got. I started from the wafer chart sample code that comes with ChartDirector, reverse the y-axis scale, and added your code for the extra field. If this still cannot solve the problem, is it possible to provide an example using random numbers, so I can try to reproduce the problem?

Best Regards
Peter Kwan


// The diameter of the wafer
int diameter = 20;
double radius = diameter / 2.0;

// The random data array are for a square grid of 20 x 20 cells
RanSeries r = new RanSeries(2);
double[] zData = r.get2DSeries(diameter, diameter, 0, 100);

// We remove cells that are outside the wafer circle by setting them to NoValue
for(int i = 0; i < zData.Length; ++i) {
    double x = i % diameter + 0.5;
    double y = (i - x) / diameter + 0.5;
    if ((x - radius) * (x - radius) + (y - radius) * (y - radius) > radius * radius) {
        zData[i] = Chart.NoValue;
    }
}

// Create an XYChart object of size 520 x 480 pixels.
XYChart c = new XYChart(520, 480);

// Add a title the chart with 15pt Arial Bold font
c.addTitle("Wafer Map Demonstration", "Arial Bold", 15);

// Set the plotarea at (50, 40) and of size 400 x 400 pixels. Set the backgound and
// border to transparent. Set both horizontal and vertical grid lines to light grey.
// (0xdddddd)
PlotArea p = c.setPlotArea(50, 40, 400, 400, -1, -1, Chart.Transparent, 0xdddddd,
    0xdddddd);

// Create a discrete heat map with 20 x 20 cells
DiscreteHeatMapLayer layer = c.addDiscreteHeatMapLayer(zData, diameter);

string[] sfield = new string[zData.Length];
for (int i = 0; i < zData.Length; ++i)
{
    if (zData[i] == Chart.NoValue)
    {
        sfield[i] = "";

    }
    else if (zData[i] > 50)
    {
        sfield[i] = "P";
    }
    else
    {
        sfield[i] = "F";
    }
}

layer.addExtraField(sfield);
layer.setDataLabelFormat("{field0}");

// Set the x-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only
// the labels visible. Set 0.5 offset to position the labels in between the grid lines.
c.xAxis().setLinearScale(0, diameter, 1);
c.xAxis().setLabelStyle("Arial Bold", 8);
c.xAxis().setColors(Chart.Transparent, Chart.TextColor);
c.xAxis().setLabelOffset(0.5);

// Set the y-axis scale. Use 8pt Arial Bold font. Set axis color to transparent, so only
// the labels visible. Set 0.5 offset to position the labels in between the grid lines.
//c.yAxis().setLinearScale(0, diameter, 1);
c.yAxis().setLinearScale(diameter, 0, -1);
c.yAxis().setLabelStyle("Arial Bold", 8);
c.yAxis().setColors(Chart.Transparent, Chart.TextColor);
c.yAxis().setLabelOffset(0.5);


// Position the color axis 20 pixels to the right of the plot area and of the same
// height as the plot area. Put the labels on the right side of the color axis. Use 8pt
// Arial Bold font for the labels.
ColorAxis cAxis = layer.setColorAxis(p.getRightX() + 20, p.getTopY(), Chart.TopLeft,
    p.getHeight(), Chart.Right);
cAxis.setLabelStyle("Arial Bold", 8);

// Output the chart
viewer.Chart = c;
test2.png

  Re: Origin questions
Posted by KeithB on Dec-18-2023 23:00
Thank you so much,I copied your code exactly and now it is working.

I am still not exactly sure why it wasn't...
My WaferFab manager will be happy!